On Thursday, February 21, 2013 10:49:42 PM UTC+1, David Nolen wrote:

>
> On Thu, Feb 21, 2013 at 4:55 AM, Marko Topolnik 
> <marko.t...@gmail.com<javascript:>
> > wrote:
>
>> Whatever the final performance achieved, the fact remains that the 
>> original Java code was much cleaner, simpler, and more comprehensible than 
>> the big ball of mud the performant Clojure version is turning into.
>
>
> To my eyes the deftype version is about as clean, simple, comprehensible, 
> as the Java version. But I've been doing Clojure for a while now.
>

My 5-year experience with Clojure (since 0.9) hasn't helped me to see it 
that way.
 

> Christophe's version also has the advantage that it can pretty much 
> compile down to efficient JavaScript via ClojureScript and probably an 
> efficient ClojureCLR program as well. This may or may not matter to you.
>

In a Java project it clearly does not matter. In library code it quite 
likely could matter a lot. That is of course a subject completely separate 
from the discussion on the pitfalls involved in getting Clojure performance 
right.

Apparently even Cristophe broke quite a bit of sweat to come up with his 
second solution, and did also wander around searching for bottlenecks (like 
.equals against =). ^:unsynchronized-mutable is something I've never layed 
my eyes on before and I've spent quite a bit of time working on optimized 
Clojure, googling for any trick I could find. What is the most trivially 
obvious way to solve a probelm in Java takes the most obscure features of 
Clojure to emulate.

Finally, Cristophe's solution, as well as all other optimized Clojure code, 
seems to be just barely making it for the use case involved. In my code, 
for example, I struggle with such things as an array of Strings (received 
from a Java method) failing when used in amap, which needs an array of 
Objects. I'm sure I could come up with yet another layer of obscurity which 
would make this work, but, as I said, after several months of struggling 
I'm ready to settle for 100 lines of clean, elegant, obvious Java.

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to