3 ms·
Sure. I'm not saying I'm a good programmer. From the comments here a lot of people seem surprised that any clojure version isn't automatically faster than a pyt
by sunkencity 16y ago
Sure. I'm not saying I'm a good programmer. From the comments here a lot of people seem surprised that any clojure version isn't automatically faster than a python one, just by the intrinsic fastness of clojure. I just don't think clojure is the go-to language for simple raw speed, but apparently I hit a nerve saying it's not super-fast because I'm getting downvoted.
As a clojure novice I would assume that just by using pmap over map, computation would be faster, but it doesn't seem like it, I've experimented a little but never gotten very good at optimizing speed in clojure, here's a little test where I thought I could get at some multi-core goodness by using pmap, but probably the lazy structures are fooling me.
https://github.com/sunkencity/Adaptor-Reductor/blob/master/src/adaptor_reductor/core.clj https://github.com/sunkencity/Adaptor-Reductor/blob/master/s...
- scottjad 16y agoWhether pmap is faster than map depends a lot on the duration of the task: see http://incanter.org/downloads/fjclj.pdf http://incanter.org/downloads/fjclj.pdf page 45
- sunkencity 16y agointeresting.
- nickik 16y agoThe video: http://clojure.blip.tv/file/4645227/ http://clojure.blip.tv/file/4645227/
- hparra 16y agoAnecdotally, at what point this is true also seems to depend on the host OS. Windows 7's pmap was beneficial at a lower n than Mac OS X's for a simple O(n) function. I have always wondered why this is. A beautiful deck, may I add!
- fogus 16y agoSure. I'm not saying I'm a good programmer. I'm not sure why your comment is being down-voted, but I can say that my question to you definitely was not meant to imply that you might be a bad programmer. My only point is this: as a budding Haskell enthusiast I am constantly shocked by the difference in succinctness between my solutions and those of the experts. However, I would never say that because of my lack of familiarity with Haskell idioms Haskell is a verbose language. The rote replacement of map with pmap will never work as a general solution because there is overhead involved with using pmap. The impact of the overhead requires thoughtfulness in usage on a case-by-case basis.
- sunkencity 16y agoHm, I suppose I can agree to that. I find that a few real-life experiments with clojure has been disturbingly slow, and that it's not trivial to optimize speed with lazy structures and magic background threads. Although some web stuff I've done has been pretty spiffy.