vcall wish for hotspot
andrew_nuss at yahoo.com
Fri May 17 08:57:07 PDT 2013
By the way, I have a simple abstract class with 2 abstract functios (before(), and after()), that are a big bottleneck in my program because generally the impls for before() and after() involve just incrementing counters in the parent class (as the impl of the abstract class is provided by an inner class). There might be lots of programs like this, and fixing the performance for pure abstract calls for class hierarchies that have no interfaces would not only correct a big performance delta relative to C++ for simple vcalls, but would make downcasts for such classes also much much faster when the programmer needs to make downcasts.
Then this funny quote from My Bunny would no longer be true:
And there would be less need for hotspot to aggressively inline small functions, consequently less bloat relative to C++ programs, and maybe even less need for hotspot to even identify and target certain functions that do simple composition wrapper forwarding as needing any further work in the JIT process.
Am I way off base?
From: Andy Nuss <andrew_nuss at yahoo.com>
To: hotspot <hotspot-compiler-dev at openjdk.java.net>
Sent: Friday, May 17, 2013 8:40 AM
Subject: vcall wish for hotspot
I profiled virtual calls on a very fast machine (core i7) after Aleksey pointing out some micro benchmark deficiencies in my benchmarking technique. Corrected those.
Nailed down the time of a virtual call on core i7: with or without interfaces involved, if a bimorphic call is enforced on hotspot due to inability to inline, the overhead is very close to 0.5 nanos, whether the method is in the base class or in an interface.
Knowing nothing about java's evolving design for interfaces and generics, I do know that C++ compilers can emit much much faster vcalls, especially when the class is not involving multiple inheritance.
That if Java knows that a class does not have interfaces, then theoretically, the bimorphic call thru the vtable of such a class should approach C++ speeds.
Is this wish ever achievable?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hotspot-compiler-dev