Android不利于动态语言 [英] Android Adverse To Dynamic Languages

查看:112
本文介绍了Android不利于动态语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我在某个时候看到,由于Android在Dalvik VM上运行,JVM(Clojure,Jython,JRuby等)的动态语言将难以在Dalvik上获得良好的性能)。如果我记得正确,推理是,在引擎盖下,为了实现动态类型,有相当多的fiddling做与java字节码和bytecode-> dalvik翻译不会轻易地接受这个。 / p>

如果我想为Android开发,我应该避免使用动态JVM语言吗?






编辑:我想我应该提供一些更多的上下文。我正在考虑使用Clojure开发Android应用程序。我正在考虑使用Clojure的原因有很多:




  • 我想学习FP

    b $ b
  • 我真的不在乎学习Java


  • Clojure似乎有一些非常有趣的语言概念但是,当我试图在Clojure中为Android编写应用程序时,我使用了Clojure中的应用程序(例如STM
    )。




<发现有一个性能问题是不可接受的。但我发现一个博客发布说,动态类型语言(例如Clojure)将有问题,由于需要的字节码操作来获取动态类型。所以我是在寻找独立确认这是真的还是不是。我应该知道更好比假设在这个特定的问题所有动态类型JVM语言可以被视为相同。我想我有一个相当广泛的问题,所以我想我不应该感到惊讶,人们不太明白我问的是什么。

解决方案

Dan Bornstein在Google I / O上对Dalvik发表了演示。值得一看,了解一般的系统,包括你关心的约束。在Q& A期间出现了编译成Java字节码的非Java语言的具体问题。



Remco van't Veer has a github project ,他修补Clojure在Android上工作。 Tim Riddell 撰写了如何使用它的教程



正如@sean在这里提到的,有时一个更大的问题, 。 Dan Bornstein在被问及〜54:00视频时遇到Jython问题。 / a>当前不支持动态语言,因为字节码翻译在运行时不可用。


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.

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


EDIT: 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:

  • I want to learn FP

  • I don't really care to learn Java

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

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.

解决方案

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 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.

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).

这篇关于Android不利于动态语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆