On Mon, Jun 25, 2012 at 12:31 AM, Christian M. <chrm...@gmail.com> wrote:

> I have developed a tiny web app in Clojure/ClojureScript and have written
> an overview here <http://notehub.org/2012/6/16/how-notehub-is-built>. In
> general, it was an exciting experience, but I also faced several problems
> with ClojureScript. For example, if you compile your code to JS, then the
> output file (in contrast to CoffeeScript) will contain other code (~18kb or
> so): this code contains the Google Closure libraries, which do a lot of
> stuff, like accessing the DOM elements.


The bulk of the "other" code is the CLJS standard lib. We currently only
use a few things from GClosure (string, object, array, etc), nothing
involving the DOM.


> Furthermore, I did experience some performance problems with
> ClojureScript, which I didn't investigate further, so I'm not sure, that
> these problems hold in general. I did some per-character computations on a
> very large text and it took just too long for such a primitive operation.
> Since my code was quite high-level I assumed, that the GC of JS engine was
> choked.
>

If you want fast string manipulating, writing very high-level code isn't
going to work. Same for hand written JavaScript.


> I think the only problem (if it is a problem at all), which won't be
> solved soon is ClojureScript's performance resulting from creating a lot of
> implicit objects in very high level computations. Something like (filter
> (map (reduce ... ... (map ...)))) can't be as fast and as memory-efficient
> for loops and in-place array operations of JS. In theory, the same holds
> for Clojure and Java as well, however, in contrast to ClojureScript, I
> never faced this problem on JVM yet.
>

There's lots of room for improving the performance of the high level
operations. That said generating fast JS from CLJS is a goal - otherwise
the data structure benchmarks would not look as good as they currently do.

I admit as with Clojure on JVM - it's not obvious how to write fast code -
even though it's not difficult. A guide on how to write fast code for
critical parts of CLJS application needs to be written up by someone.

David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to