invokedynamic 及其对应用程序开发人员的优势
最近,我正在阅读有关 Java 7 功能的文章,invokedynamic 是最令人期待的功能之一。大多数博客/文章都从 JVM 实现的角度提供了优点,特别是对于动态类型语言。从应用程序开发人员的角度来看,它对我有何影响?
Recently, i was reading about Java 7 features and invokedynamic was one of the most anticipated one. Most of the blogs/articles provide the advantages from JVM implementation point of view, specially for dynamically typed languages. From an application developer point of view, how does it affect me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用这些动态语言之一编写应用程序,您的应用程序(可能)会运行得更快。尤其是 JRuby 目前大量使用它。
如果你用Java编写,它不会影响你,因为Java(当前)不使用这个指令。我认为有一些讨论称 Java 8 语言功能之一可能正在使用它,但我现在找不到对此的参考,而且 Java 8 距离现在还有很长的路要走。
If you're writing an application in one of these dynamic languages, your app will (probably) run faster. Especially JRuby makes heavy use of it at the moment.
If you're writing in Java, it won't affect you, because Java (currently) doesn't use this instruction. I think there was some talk that one of the Java 8 language features might be using it, but I can't find a reference to that right now, and Java 8 is a long way away right now anyway.
在 Java 中,您可以使用 MethodHandle 作为反射的更快替代方案。您可以在此处阅读有关 MethodHandles 的更多信息。
请注意,MethodHandle 不使用 invokedynamic,但开发 MethodHandle 功能是为了提供对 invokedynamic 的支持。对于 Java 应用程序开发人员来说,MethodHandle 是调用动态工作中产生的唯一好处。
In Java you can use MethodHandle as a faster alternative to reflection. You can read a bit more about MethodHandles here.
Note that MethodHandle does not use invokedynamic, but MethodHandle feature was developed to provide support for invokedynamic. For a Java application developer MethodHandle is the only benefit that arises out of the work towards invokedynamic.