I have been comparing the generated javascript outputed by various calls in clojurescript and it feels like stepping on landmines. Some generate extremely readable (even in minified advanced mode) javascript and some decide this one method call is going to require what seems like every possible method in clojure to run.
nth vs aget is a very good example of this. Both of these code snippets output the number 5 but one takes 77 bytes to do it and the other takes 57 kilobytes. Thats an increase of 74026%
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 generated by aget is very readable. (formatting put in by hand)
;(function(){
var a=console.log,
b=[5];
a.a ? a.a(b[0]) : a.call( null, b[0] );
})();
generated nth code in a gist https://gist.github.com/trashhalo/7781298\
clojurescript 0.0-2014