JVM 上性能最高的 Lisp 是什么
JVM 上性能最高(最快)的 Lisp 实现是什么? 通过 lisp 实现,我考虑了 lisp 系列中任何语言的所有实现,例如 Common Lisp、Scheme、Clojure...
我知道使用类型提示可以使 Clojure 变得相当快,而 ABCL 通常不被认为是快的。我没有在 JVM 上使用任何Scheme 的经验,但听说 Kawa 也很快。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
过去几周我一直在测试各种 Lisp。就启动时间、REPL 响应时间和运行基本脚本而言,Kawa 是迄今为止我尝试过的最快的 JVM 实现。作者发布了 2010 年的一些性能统计数据,显示 Kawa 的性能明显优于 clojure。 YMMV。
http://per.bothner.com/blog/2010/Kawa-in -枪战/
I've been testing various lisps over the last few weeks. Kawa is the fastest JVM implementation I've tried so far in terms of startup time, REPL response time and running basic scripts. The author posted some performance statistics in 2010, which shows that Kawa outperforms clojure by a clear margin. YMMV.
http://per.bothner.com/blog/2010/Kawa-in-shootout/
使用 Clojure,您可以达到 Java 的速度(当然需要类型提示),并且您无法获得比 Java 更快的速度(除非在某些非常罕见的情况下)。我不知道其他 lisp 的速度可能相同,但不会更快。
这就是关于标准通话速度等等的内容。
Clojure 的数据结构并不总是尽可能快,但确实可以通过线程安全、不可变和快速读取等其他属性来弥补。
为了使数据结构更快,Rich 发明了瞬态,使它们能够以仍然可用的方式可变(并且速度更快),并且他已经在致力于下一件大事(阅读有关 rich 的新兴语言阵营的讨论) 。
使用 clojure 编写并发代码要容易得多,因此真正可以导入它来编写快速程序。
所以接下来的事情是数学。 JVM 上的速度分为三个级别。带有盒装类型的数学、带溢出检查的原始类型或不带溢出检查的数学。 Clojure 提供了所有这些,因此没有限制。
因此,接下来的事情是你能以多快的速度使用 Java,如果你必须使用包装器,你的性能就不会那么好,而且 Java 调用在大多数 JVM 语言中都经常使用。为了在 clojure 中实现 clojure,clojure 需要添加一个低级构造,以便您可以与 java 交互而无需任何开销。
因此 clojure 的速度与 JVM 上的速度一样快。
PS
协议就像非常快速的多方法,虽然不是那么通用,但调度速度足够快,可以在 clojure 核心中使用它们(因此不再依赖于 java)。查一下它们很酷。
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.
虽然这个和其他一些数据似乎表明了显而易见的事实,但并没有很多好的数据。不可变语言在执行非不可变任务时会受到轻微影响,而非不可变语言在执行高度并行任务时会受到影响。
在考虑这些问题时,考虑“故障恢复选项”会有所帮助。对于探查器告诉您没有发挥作用的任何代码部分,Clojure 都可以回退到 java。
简而言之:我投票 Clojure :)
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 :)
如果它不是 clojure,我会感到惊讶。据我所知,没有其他 JVM Lisp 对性能给予如此多的关注。最快的方案可能是 SISC - 它被编译为 FASL 格式,但仍然不是“本机”JVM 指令级别。
I'd be surprised if it is not clojure. No other JVM lisp I know of has had as much attention paid to performance. The fastest Scheme is probably SISC - it's compiled to a FASL format, but still not "native" JVM instruction level.