Android的不利动态语言不利、语言、动态、Android

2023-09-05 06:22:33 作者:无人街角

我相信我读在某一时刻,由于在Dalvik虚拟机,动态语言的JVM(Clojure的,Jython中,JRuby的等),运行Android将pssed获得有关的Dalvik不错的表现很难$ P $(和因此,在Android)。如果我没有记错的理由是,在引擎盖下,为了实现动态类型,有相当多的与Java字节code了蹊跷完成,该字节code-> Dalvik的翻译止跌'T接这件事很容易。

I believe I read at some point that due to Android running on the Dalvik VM, that dynamic languages for the JVM (Clojure, Jython, JRuby etc.) would be hard pressed to obtain good performance on Dalvik (and hence on Android). If I recall correctly, the reasoning was that under the hood, in order to achieve the dynamic typing, there was quite a bit of fiddling done with the java bytecode and that the bytecode->dalvik translation wouldn't pick this up easily.

所以我应该避免动态的JVM语言,如果我想开发的Andr​​oid?

So should I avoid a dynamic JVM language if I want to develop for Android?

编辑:我想我应该提供更多的背景。我正在考虑使用Clojure的发展for Android应用程序。我想使用Clojure的几个原因:

I guess I should have provided a bit more context. I was considering using Clojure to develop apps for Android. I was thinking about using Clojure for a few reasons:

我想学习FP

I want to learn FP

我真的不关心学习Java

I don't really care to learn Java

的Clojure似乎有一些非常 有趣的语言概念(STM 例如)。

Clojure seems to have some very interesting language concepts (STM for example).

然而,当我试着写Clojure中的Andr​​oid应用程序,我发现有一个性能问题,这是不能接受的。但是,我发现了一个博客张贴的说,动态类型语言(Clojure的为例)将有问题,由于需要得到动态类型字节code操作。那种所以我一直在寻找独立确认这是真的或不是。我应该知道比作,在这个特定问题的所有动态类型的JVM语言可被视为相同的假设。我想我曾问一个相当宽泛的问题,所以我想我不应该感到惊讶,人们不很明白我在问。

However, when I tried to write apps for Android in Clojure, I found that there is a performance issue that is unacceptable. But I found a blog posting that said that dynamically typed languages (Clojure for example) would have problems due to the bytecode manipulation needed to get the dynamic typing. So I was sort of looking for independent confirmation that this is true or it isn't. I should have known better than to make the assumption that in this particular issue all dynamically typed JVM languages could be treated as the same. I guess I did ask a fairly broad question so I guess I shouldn't be surprised that people didn't quite understand what I was asking.

推荐答案

丹·伯恩斯坦发表了的在谷歌上的Dalvik presentation I / O 。这是值得关注,了解系统在一般情况下,包括您所关心的约束。非Java语言中的具体问题,编译成Java字节code出现在Q&放大器; A

Dan Bornstein gave a presentation on Dalvik at Google I/O. It's worth watching to learn about the system in general, including the constraints you care about. The specific issue of non-Java languages compiled into Java bytecode comes up during the Q&A.

REMCO范'T德维尔拥有的 github上项目在那里他修补Clojure的工作,在Android上。 写了的教程如何使用它。

Remco van 't Veer has a github project where he's patched Clojure to work on Android. Tim Riddell has written a tutorial on how to use it.

由于这里由@sean提到的,有时不仅仅是表现一个更大的问题。丹·伯恩斯坦讨论它,当被问及Jython的,在〜54:00在视频目前为其生成字节code对即时,(因为字节code翻译不是在运行时可用)。

As mentioned here by @sean, there is sometimes a bigger problem than just performance. Dan Bornstein discusses it when asked about Jython, at ~54:00 in video. There is currently no support for dynamic languages which generate bytecode on-the-fly, (because the bytecode translation is not available at runtime).

 
精彩推荐
图片推荐