Fork me on GitHub
#cljs-dev
<
2017-09-06
>
mfikes20:09:18

Oddly, applying https://dev.clojure.org/jira/browse/CLJ-99 to ClojureScript slows it down, so perhaps not worth doing. Current:

Benchmarking with V8
[], (apply max-key (fn* [p1__14089#] (Math/tan p1__14089#)) (range 1000)), 1000 runs, 183 msecs
Benchmarking with SpiderMonkey
[], (apply max-key (fn* [p1__14089#] (Math/tan p1__14089#)) (range 1000)), 1000 runs, 67 msecs
Benchmarking with JavaScriptCore
[], (apply max-key (fn* [p1__14089#] (Math/tan p1__14089#)) (range 1000)), 1000 runs, 88 msecs
Benchmarking with Nashorn
[], (apply max-key (fn* [p1__14089#] (Math/tan p1__14089#)) (range 1000)), 1000 runs, 952 msecs
Benchmarking with ChakraCore
[], (apply max-key (fn* [p1__14089#] (Math/tan p1__14089#)) (range 1000)), 1000 runs, 544 msecs
after patch:
Benchmarking with V8
[], (apply max-key (fn* [p1__14105#] (Math/tan p1__14105#)) (range 1000)), 1000 runs, 181 msecs
Benchmarking with SpiderMonkey
[], (apply max-key (fn* [p1__14105#] (Math/tan p1__14105#)) (range 1000)), 1000 runs, 79 msecs
Benchmarking with JavaScriptCore
[], (apply max-key (fn* [p1__14105#] (Math/tan p1__14105#)) (range 1000)), 1000 runs, 143 msecs
Benchmarking with Nashorn
[], (apply max-key (fn* [p1__14105#] (Math/tan p1__14105#)) (range 1000)), 1000 runs, 1140 msecs
Benchmarking with ChakraCore
[], (apply max-key (fn* [p1__14105#] (Math/tan p1__14105#)) (range 1000)), 1000 runs, 361 msecs

Alex Miller (Clojure team)20:09:29

do you really want to test with apply?

Alex Miller (Clojure team)20:09:51

I guess not much choice. it seems weird to me that these take varargs and not a coll

mfikes20:09:42

@alexmiller FWIW, I was blindly attempting to repro the pref gain in the description of https://dev.clojure.org/jira/browse/CLJ-99, which uses (apply max-key #(Math/tan %) (range 1000)) and seems to get a 1.6 speedup in Clojure.

Alex Miller (Clojure team)21:09:45

I belatedly realized all that :)