I wanted to find out which of creating a partial function is faster in Clojurescript. For example for adding two numbers, which of the two is faster:
I couldn’t find a library which does this kind of benchmarking in a organised way. Luckily I found benchmark.js which is used in jsPerf.com. Helpfully it even ran in the browser which was the environment I was looking to run my code in.
I then created a very simple front-end using Reagent.
The main bit of code is which is using the API of benchmark.js:
P.S. Oh and the benchmark timings for my experiment are (on my Macbook Pro):
|Chrome (52.0.2726.0 canary)||2.28072563822e-8||1.090017047466e-8|
|Safari (9.1.1 (11601.6.14))||8.75162575482e-9||5.509248548052e-9|
In all browsers
#(+ 1 %) is faster. But enough of micro-benchmarking.