On 2/24/13 1:34 PM, Marko Topolnik wrote:

    I'm no Haskell expert, but it doesn't take much Googling to give
    strong evidence that the answer is "yes, you can get mutability in
    Haskell".  Search through this Haskell program on the Benchmarks
    Game site for occurrences of the string "unsafe".


I see; quite disgusting :)

    In my experience writing Clojure programs for the Benchmarks Game,
    getting within 10x is fairly easy, and doesn't require much
    knowledge other than eliminating Clojure reflection, and using a
    decent algorithm that doesn't throw in an extra factor of N by
    accident.  It often helps to use mutable Java arrays and Clojure
    loops, too.


The default Clojure idiom is lazy seqs and higher-order functions. That's what I have in mind when I say 100x slower. Loops, and especially arrays, are a clear sign of optimization; they never come as the most natural way to express a solution.

In languages such as Java there is just one idiom: the performant one. That's why idiomatic Java performs well. In languages such as Clojure, the most expressive idiom, the one the language is appreciated for, is a level of abstraction or two above the performant idiom, so the interesting question becomes, how much performance can be engineered into /that/ level of abstraction. The question of the absolute performance ceiling achievable within the language is also of interest, but only secondary.

Now, my issue with a site such as the Benchmarks Game is that it will never give a fair representation of that concern, and I bet it is exactly this that most visitors of the site come looking for. That is what I meant when I said that Haskell is quite performant: I've heard /idiomatic/ Haskell performs well. I really couldn't care less how it performs with those /unsafe/ monstrosities. Those features are, and should be, reserved for the language's entrails, like the implementation of the IO monad.

Yeah, I wish the Benchmarks allowed for idiomatic submissions and finely tuned submissions. That would allow you to get some sort of an idea how performant the dominant idiom is. Along those lines this older post did an interesting analysis on the benchmark solutions where it explored the tension that exists between expressiveness and performance across the various languages:

http://blog.gmarceau.qc.ca/2009/05/speed-size-and-dependability-of.html



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