On Thu, Aug 25, 2011 at 5:18 AM, Paulo Pinto <paulo.jpi...@gmail.com> wrote:
> invokedynamic reduces drastically the lookup times you require in
> dynamic languages. The JVM and JIT understand what you are trying
> to do and can optimize the invocation.

It's important to note that this only applies to method calls, not
function invocations.

> Currently all dynamic languages targeting the JVM generate code
> that cannot be easily optimized by the JVM before invokedynamic
> was available.

That's not really true; it's easy in Clojure to optimize with type
hints. Since Ruby isn't designed to run on the JVM, it doesn't have
any syntax for type hints to avoid reflective calls. I believe method
calls that use invokedynamic are much faster than reflective
(non-hinted) method calls, but still a bit slower than type-hinted
calls. So if you are in a tight loop you'll need to type hint anyway.

I suspect we'd get a lot more bang-for-the-buck out of type inference
than invokedynamic since that may allow us to get the benefits of type
hints without the grunt work of scattering declarations everywhere.

-Phil

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to