News for hackers. Stuff that matters.
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by swannodette on Wednesday March 30, 2011 @08:43AM (#2386923)
http://shootout.alioth.debian.org/u32/which-language-is-best...

Not true according to these microbenchmarks and certainly not in my own experience.

Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by sunkencity on Wednesday March 30, 2011 @08:51AM (#2386943)
YMMV. I find that stuff I write in Ruby is faster than that I write in clojure. I suppose it depends on the problem space, if your problems are greatly speeded up by mutability and C bindings then clojure is not a perfect fit.
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by fogus on Wednesday March 30, 2011 @09:32AM (#2387072)

    I find that stuff I write in Ruby is 
    faster than that I write in clojure.
Have you considered the possibility that the problem is not with Clojure?
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by sunkencity on Wednesday March 30, 2011 @10:29AM (#2387343)
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/s...

Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by fogus on Wednesday March 30, 2011 @10:52AM (#2387459)

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

Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by sunkencity on Wednesday March 30, 2011 @11:41AM (#2387740)
Hm, 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.

Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by scottjad on Wednesday March 30, 2011 @10:44AM (#2387426)
Whether pmap is faster than map depends a lot on the duration of the task: see http://incanter.org/downloads/fjclj.pdf page 45
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by hparra on Wednesday March 30, 2011 @02:07PM (#2388394)
Anecdotally, 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!

Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by sunkencity on Wednesday March 30, 2011 @11:28AM (#2387656)
interesting.
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by nickik on Wednesday March 30, 2011 @01:26PM (#2388223)
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by fbru02 on Wednesday March 30, 2011 @09:36AM (#2387086)
While sometimes it's great that you have the option to use C bindings in Ruby, my take is that if possible you should write stuff in Ruby when doing Ruby. If that's not the case you are not doing ruby, you are doing C.
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by nickik on Wednesday March 30, 2011 @10:04AM (#2387211)
I would write clojure and drop back to java for speed. Only in a extrem case I would then use C, but its possible. I haven't done it but read that its not all that bad. (there is a clojure wrapper.
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by sunkencity on Wednesday March 30, 2011 @09:53AM (#2387160)
I'm using ruby to glue together fast stuff in C.
Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by nickik on Wednesday March 30, 2011 @09:35AM (#2387083)
I think your statmend is missleading.

1. I guess you compair small programms and clojure suffers from the JVM startup slowness not because of the clojure implementation.

2. You can use java objects, collection or arrays from clojure its just not often used.

3. Clojure has very good Java bindings and I think the C bindings arn't that bad. (there is a wrapper ofer the normal java stuff)

I guess ruby only performs better for scripting.

Re:Peter Norvig's Sudoku solver: Clojure & Python side by side by igouy on Wednesday March 30, 2011 @12:33PM (#2387950)
Do you see why people might have thought your comment was misleading, with the "fast stuff in C" not in Ruby? :-)

http://shootout.alioth.debian.org/u32/benchmark.php?test=all...