Performance in Factor, Java, and Clojure
ideolalia.com
ideolalia.com
However, the defmap and defreduce macros in the snippet abstract away all that boilerplate, resulting in something that is both significantly faster than the standard approach, and significantly more concise. The Factor vs. Java benchmark seemed like a decent way to demonstrate that.
In that case wouldn't a fairer comparison be between java code that targets the GPU and factor code that also targets the GPU. Right now its seems that the only valid conclusions is code that targets the GPU is better than code that targets the CPU (for certain kinds of tasks).
That being said, I think that ease of development is a more practical metric for comparison than the underlying methods. Clojure lends itself to translation into GLSL, which has useful vector functionality, so it ends up being simpler and more concise to target the GPU than it would be to write it in plain Clojure. You could certainly use the GPU in other languages and achieve equal or better performance, but in the vast majority of cases it would not be the path of least resistance.
How so more than factor? Factor (like Forth) is just a set of words and it is easy to conceive of a GLSL vocabulary for it(I use "vocabulary" in the Forth/Factor sense).
How is "10 sq 5 - ." (Factor/Forth) "less translatable" than "(- (square 10) 5)" [Clojure/lisp]?
" You could certainly use the GPU in other languages and achieve equal or better performance, but in the vast majority of cases it would not be the path of least resistance."
Well here we aren't talking of most cases ( :-) )but specifically Factor vs Clojure. I hope you take the time to explain why you think Clojure is superior to Factor in this respect (if that is the point you were making). Comparing metrics of languages compiling to different chips make little sense.
Comparing Clojure compiling to the GPU and Factor compiling to the CPU makes as much sense as comparing Clojure compiling to Intel and Factor comparing to something entirely different (say the ARM). Specific tasks will be faster on one or the other. So what? Two things differ(the language being compiled and the compiled to chip) making any "comparisons", at best dubious.
My comment above was referring more to Java, which is generally considered to be the apex of potential performance for Clojure, but which would completely incapable of something like this. I didn't mean to lump Factor and Java together, sorry for the imprecision.
Ok, No arguments then, if the expressiveness, succinctness and malleability of java vs Clojure were the point of comparison. Factor vs Clojure would be a dead heat I imagine.
The original article makes the statement
" That's 4x faster than the optimized Factor code, and more than 10x faster than Java."
I was saying this comparison is not only meaningless but misleading. The statements should be something like
"The Clojure code (which compiles to the GPU) is 4x faster than the optimized Factor code (which compiles to the CPU) , and more than 10x faster than Java(which compiles to the CPU). GPUs and CPUs make different speed tradeoffs so the above is meaningless btw "
For language speed comparisons to be (somewhat) meaningful, they should have a common baseline environment. If each language compiles to a different type of chip (GPU vs CPU in this case) there is no valid "comparison".
Looking further into it I think I found that JOGL seemed to be a somewhat abandoned project (sortof like Java3D), and that the real action was with LWJGL/jMonkeyEngine. Both had a far larger and more active community, and LWJGL supported more OpenGL features, and LWJGL may have been faster than JOGL too, although again, you're bringing up a fairly old memories, so I can't say they're perfectly accurate, I may in fact be spewing nonsense.
I'd say take a look at both and compare.