I compared the generated javascript received by various calls to clojurescript, and it feels like switching to land mines. Some of them generate extremely readable (even in extended advanced mode) javascript, and some decide that this method call will require all possible methods to be executed in clojure.
nth vs aget is a very good example of this. Both of these code snippets print the number 5, but this requires 77 bytes and the other 57 kilobytes. This is an increase of 74,026%
57 KiloBytes - nth
(ns fooModule) (let [log js/console.log x (array 5)] (log (nth x 0)))
77 bytes - aget
(ns fooModule) (let [log js/console.log x (array 5)] (log (aget x 0)))
The code created by aget is very readable. (formatting is done manually)
;(function(){ var a=console.log, b=[5]; aa ? aa(b[0]) : a.call( null, b[0] ); })();
generated nth code in gist https://gist.github.com/trashhalo/7781298 \
clojurescript 0.0-2014
javascript clojure clojurescript
Stephen solka
source share