On Friday, January 16, 2015 at 11:16:58 PM UTC+1, Colin Kahn wrote:
> What is the expected size for the optimized "hello" sample? If I use:
> 
>     cljsc src {:optimizations :advanced :pretty-print true} > hello.js
> 
> I get a file of 4,854 lines.

I was experimenting today as I am still learning cljs and "discovered" that you 
get less than a page if none of the persistent collections are used. It still 
has some garbage, but much closer to what coffeescript would've produced. 
Example:

if (typeof Math.imul == "undefined" || (Math.imul(0xffffffff, 5) == 0)) {
    Math.imul = function (a, b) {
        var ah = (a >>> 16) & 0xffff;
        var al = a & 0xffff;
        var bh = (b >>> 16) & 0xffff;
        var bl = b & 0xffff;
        // the shift by 0 fixes the sign on the high part
        // the final |0 converts the unsigned value into a signed value
        return ((al * bl) + (((ah * bl + al * bh) << 16) >>> 0) | 0);
    }
}

;
(function () {
    if ("undefined" === typeof a) {
        var a = function () {
            throw Error("No *print-fn* fn set for evaluation environment");
        }
    }
    if ("undefined" === typeof b) {
        var b = null
    }
    if ("undefined" !== typeof Symbol) {
        var c = Symbol;
        "object" != typeof c || !c || c instanceof Array || c instanceof Object 
|| Object.prototype.toString.call(c);
    }
    "undefined" !== typeof Math.imul && (Math.imul.a ? Math.imul.a(4294967295, 
5) : Math.imul.call(null, 4294967295, 5));
    console.log("just testin'", "test");
    console.log("just testin'", ["xyz"]);

})();

this is the source:

(ns simple)

(defn myFunc [a]
  (js/console.log "just testin'" a))

(myFunc "test")

(myFunc (js/Array. "xyz"))

;(myFunc ["x" "y"])



-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to