Hmm yesterday Rick said that the new changes give clojure a chance to put down 
the 'scala is faster then clojure' argument. So I figured I give it a try and 
implemented some of the shootouts: fannkucken-redux and the regexdna example. I 
found some interesting things especially once I got carried away with hoeck's 
question how it looks when you benchmark ideomatic clojure 1.2-master vs 
1.2-equal.

As a foreword:
1) I most likely suck at optimizing so I very much welcome any suggestions and 
changes.
1.1) As a result of that please don't take the results I got as abseluts so 
they still are interesting
2) The benchmarks I did are flawed and unfair since I did not do warmup runs 
nor did I remove the JVM startup time, BUT they are unfair for everyone in the 
same manner so I hope that evens things out a bit.
3) The idiomatic code is NOT optimized at all, it is the nicest way I found to 
write the code, or at least the one that seemed most natural to me.


My findings:

A) Comparison to Scala
So first of all it seems clojure is still slower then scale (at least in this 
particular benchmark and with my very limited skills in optimization), the 
optimization was done but there are still things to improve and I know that but 
we're coming closer :)

B) The process of optimization
During the process of optimization I sadly did not feel big relieve brought by 
the equal branch, optimizing code feels still horrible and painful. And the 
code that I got looks more like java with different parenthethes then clojure  
to me - I personally feel ashamed to have written it :(

C) ideomatic clojure master vs. equal
I know again this is just a one piece observeration but I am torn. Over all 
execution time for the fannkuchen example has degraded nearly 20% with the 
equal branch (using same code) yet in profiling it looked faster. I am not 
certain why it seems that equal adds some overhead, hoeck had the same finding 
when not benchmakring JVM execution speed but using criterium to benchmark and 
even in code benchmarking (using time) indiceates equal to be slower in this 
case. I'm not sure how to explain this to be frank, my guess is that some 
optimization hurt the list speed or that the profiler makes odd things.


Code can be found here:

http://github.com/Licenser/clj-shootout

screenshots of some profiling results:

http://grab.by/55po (euqual branch)

http://grab.by/55pp (master branch)

Regards,
Heinz 

-- 
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