5 ms·
No offense, but I'm not sure that the Language Shootout is the best showcase, the SBCL code submitted there could hardly be called idiomatic Common Lisp. Mandel
by mmp 13y ago
No offense, but I'm not sure that the Language Shootout is the best showcase, the SBCL code submitted there could hardly be called idiomatic Common Lisp. Mandelbrot is one of the most egrerious offenders in that regard [1], compare that with the Java submission [2] which is both cleaner and faster...
[1]http://benchmarksgame.alioth.debian.org/u64/program.php?test=mandelbrot&lang=sbcl&id=1 http://benchmarksgame.alioth.debian.org/u64/program.php?test...
[2]http://benchmarksgame.alioth.debian.org/u64/program.php?test=nbody&lang=java&id=2 http://benchmarksgame.alioth.debian.org/u64/program.php?test...
- emiljbs 13y agoWhen the text of a post is greyed out, has it then received a bunch of downvotes? // From a HN newbie who's already wondered this
- adbge 13y agoIt has received more downvotes than upvotes.
- ww520 13y agoJava is not exactly popular here, especially when compared to Lisp. It has an affinity for downvotes.
- jamesaguilar 13y agoYes. To be specific, if the net votes are -4, a post is maximally downvoted.
- jules 13y agoYou probably meant to link to this Java code: http://benchmarksgame.alioth.debian.org/u64/benchmark.php?test=mandelbrot&lang=java http://benchmarksgame.alioth.debian.org/u64/benchmark.php?te...
- derleth 13y ago> the SBCL code submitted there could hardly be called idiomatic Common Lisp That's the point of Common Lisp: It gives you enough rope. Some people use it to hang themselves, others use it to selectively optimize the parts that need it, still others use it to optimize the whole thing.
- nnq 13y agoAll languages have "layers/levels" at which one uses them. Isn't the whole point of a language shootout to compare "default levels", that is levels at which the "average programs" are written, and not the kilometers of rope stored in the levels below? (or is it really true that there isn't a "default level" for CL?)
- lukego 13y agoI think you are right that there is no "default level" for CL. I find this an interesting point of programming language culture - what do people do when they want to optimize. In Erlang the culture is to write your code in a straightforward way and you accept the performance you get. "Inner loop" code looks much like any code. It's a point of pride that you stick with the same style throughout and don't burn brain cycles looking for tricks. In Common Lisp the culture is to write performance-critical inner loops in a very different way to other code. So although the code on the shootout page looks weird compared to most Common Lisp code, it does look like code that a Lisp programmer would write when they are in deep optimization mode.
- zerr 13y agoI get your point, but when the performance requirement is put on the table (hence a need for optimizations), in the first place I wouldn't choose Lisp.
- nnq 13y agoSeriously asking, for this code example (I don't have enough CL experience to tell from this sample): are these optimizations at least generally CL specific, or are they tailored to SBCL specifically? would the same performance benefits apply to Clozure CL or to a bytecode compiled variant like CLISP?
- nnq 13y agoIndeed, the Java code is readable to someone who's just picked up a Java book/tutorial, while that CL code is like an "obsfucated mandarind local dialect" to someone just starting to learn CL (even to someone pre-exposed to SICP Scheme or other lisp-family languages)! I think it's closer to someone writing Python code specifically tailored to the way PyPy does JIT or smth like that, but that wouldn't be idiomatic Python in a thousand years, or even "comprehensible by the average Python coder".
- JulianMorrison 13y agoI find it interesting how particularly readable the Go code on there is compared to Lisp. And I'm not talking syntactical fluff, I'm talking semantics - the Lisp dances around doing macros, toggling compiler switches (including nonstandard ones that are specific to SBCL), redefining things... the Go just says "do this then do that". And its speed is roughly comparable.
- rayiner 13y agoGo is also a statically typed language with a compiler written in the last two decades...
- delian66 13y agoThe links which you have given above, are for 2 different simulations - the SBCL one is computing the mandelbrot set, and the Java one is doing an n-body simulation. That said, I agree with your point ... is seems to me pointless to effectively program in assembly in another language and then claim that the wraper language is faster/better ... given enough determination, you can do the same with most other languages and it proves nothing.