News for hackers. Stuff that matters.
Re:Comparing clojure and node.js for speed by calpaterson on Thursday April 07, 2011 @06:50PM (#2421545)
Trial division (your algorithm) _is_ linear time, there exist better than linear time algorithms for this, and they're pretty easy to understand (look for Solovay-Strassen on wikipedia for a simple one).

Furthermore, this isn't a great test. For one, you're specifically testing a performance profile that the JVM does not bother to optimise for (programs that run for less than about 20 seconds). For two, number speeds aren't a great measure - the issues with autoboxing (that I think Clojure does - I'm not a user) and whether the implementation is simply calling libgmp (maybe V8 is? Seems sensible to expect that it would - but I am also not a user of javascript) kind of predecide the outcome.

There are no comments on this comment yet.