|
|
|
|
|
by anonjon
6061 days ago
|
|
I think that it is difficult to know what constitutes a 'fair benchmark' for Clojure. Are we talking unadorned Clojure, Clojure with type annotations, Clojure using Java structures, or Clojure calling Java code? Clojure calling Java is as fast as Java (obviously). And what if I had 60 cores as opposed to just 4 or 8? Parallel naive Clojure would then be 4 times faster than the Java version. The parallel clever version in Clojure would most likely be much faster. And barring a breakthrough in quantum computing, you will some day have 60+ CPUs in your desktop. Most of the benchmarks that I have seen that were legitimately 10x the time of Java were using unadorned Clojure on Clojure data structures... of course it is slower, the machine is doing a lot more for you. And it is well and good that this is the case, because the purpose of Clojure is not to make that tight loop really fast; it is to get the logic of your program correct and avoid a lot of the subtle bugs that can happen. Concurrency has many advantages above and beyond parallelism. As far as getting along without macros and lazy evaluation and heterogeneous immutable data structures, I will say that for a long time we got along 'just fine' without garbage collection; but now it is a feature of a large subset of languages (to the extent that Google has now added it to C). |
|
As far as all computers having 60 cores some day, if your clojure code is 10 times slower than my Java code, I only have to use 6 of my 60 cores to be as fast as your clojure program, which would be bringing my 60 core system to it's knees. It's not like you can't parallelize in Java! It's going to be decades indeed before a 5-10x reduction in performance doesn't matter because of ubiquitous core availability.