Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the most performant lisp on the JVM

What is the most performant (fastest) lisp implementation on the JVM? By lisp implementation I consider all implementations of any language in lisp family, like Common Lisp, Scheme, Clojure, ...

I know that Clojure can be made pretty fast using type hints, that ABCL is in general not considered to be fast. I don't have experience using any Scheme on JVM, but heard that Kawa is pretty fast too.

like image 776
Marko Avatar asked Jul 29 '10 21:07

Marko


2 Answers

With Clojure you can get to the speed of Java (with type hints of course) and you can not get faster than java (exept in some very rare cases). I don't know about the other lisps the are maybe the same speed but not faster.

So that said about the standard speed of calls and so on.

Clojure has data structures are not always as fast as possible but the really make up for that with there other properties like thread safety, immutable and fast reading.

To make the data structures faster Rich invented transient with make them mutable in a way that they are still functional (and the are a LOT faster) and he is already working on the next big thing (read about the Emerging Languages camp talk of rich).

Its much easier to write concurrent code with clojure so that is really imported for to make fast programmes.

So the next thing is math. There are three levels of Speed on the JVM. Math with boxed Types,primitiv Types with overflow checking,or without overflow checking. Clojure provides all of those so no limit there.

So the next thing is how fast can you work with Java, if you have to use wrappers you wont perform as good and java calls are used often in most JVM languages. To implement clojure in clojure, clojure needed to add a low level construct so that you can interact with java without any overhead.

So clojure is as fast as it gets on the JVM.

P.S.

Protocols are like really fast multmethods witch are not that generic but the dispatch fast enough to use them in clojure core (and so not depend on java anymore). Look them up the are way cool.

like image 95
nickik Avatar answered Oct 11 '22 13:10

nickik


not a whole lot of good data though this and some others seem to indicate the obvious. Immutible languages suffer slightly when doing non-immutable tasks, and non-immutable languages suffer when doing highly parallel tasks.

When considering these questions it helps to consider the "fail back option". Clojure can fall back to java for any part of your code that the profiler tells you is not pulling its wight.

in short: I vote clojure :)

like image 44
Arthur Ulfeldt Avatar answered Oct 11 '22 13:10

Arthur Ulfeldt