Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by

In the PAM {{-conj}} implementation, {{-nth}} is used, but instead invoking the vector or map entry on the desired index is faster by about 10% on V8 and JavaScriptCore.

For example, to get the first element, instead of {{(-nth x 0)}}, {{(x 0)}}. See CLJS-3111 for justification / check that would allow us to safely assume that {{(x 0)}} and {{(x 1)}} are valid.

Additionally, in the branch where it is dealing with map entries, not only is {{(x 0)}} faster, but {{(-key x)}} is even faster (in particular in :none on JavaScriptCore). CLJS-3115 argues that we should be able to assume map entries in this portion of the code.

1 Answer

0 votes
Reference: https://clojure.atlassian.net/browse/CLJS-3116 (reported by mfikes)