简体   繁体   English

invokedynamic及其对应用程序开发人员的优势

[英]invokedynamic and its advantages to application developer

Recently, i was reading about Java 7 features and invokedynamic was one of the most anticipated one. 最近,我正在阅读有关Java 7功能的信息,invokedynamic是最令人期待的功能之一。 Most of the blogs/articles provide the advantages from JVM implementation point of view, specially for dynamically typed languages. 从JVM实现的角度来看,大多数博客/文章都提供了优势,特别是对于动态类型的语言。 From an application developer point of view, how does it affect me? 从应用程序开发人员的角度来看,这对我有什么影响?

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. 特别是JRuby现在大量使用它。

If you're writing in Java, it won't affect you, because Java (currently) doesn't use this instruction. 如果您使用Java编写,它不会影响您,因为Java(当前)不使用此指令。 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 8语言功能之一可能正在使用它,但是我现在找不到对此的引用,而且Java 8现在距离还有很长的路要走。

In Java you can use MethodHandle as a faster alternative to reflection. 在Java中,可以将MethodHandle用作反射的更快替代方法。 You can read a bit more about MethodHandles here . 您可以在此处阅读有关MethodHandles的更多信息。

Note that MethodHandle does not use invokedynamic, but MethodHandle feature was developed to provide support for invokedynamic. 请注意,MethodHandle不使用invokedynamic,但是开发了MethodHandle功能来提供对invokedynamic的支持。 For a Java application developer MethodHandle is the only benefit that arises out of the work towards invokedynamic. 对于Java应用程序开发人员来说,MethodHandle是唯一的因调用动态而产生的收益。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM