Hotspot loves PHP.reboot
Charles Oliver Nutter
headius at headius.com
Tue Sep 6 07:59:43 PDT 2011
Awesome numbers, especially promising for impls like JRuby that will
never have type annotations and for which type inference will be very
limited. Getting within 3x Java while still fully boxed is amazing.
Perhaps the next big thing for InDy will be getting EA working across
invokedynamic boundaries? Perhaps someone can explain why that's
difficult (or impossible) now, since it seems to me that generating a
bytecoded form for MH trees should allow EA to work as with any other
code. No?
- Charlie
On Mon, Sep 5, 2011 at 8:09 AM, Rémi Forax <forax at univ-mlv.fr> wrote:
> On 09/05/2011 12:22 PM, Christian Thalinger wrote:
>> On Sep 5, 2011, at 1:11 AM, Rémi Forax wrote:
>>
>>> I've just compiled the hotspot (64bits server) using the hotspot-comp
>>> workspace of hotspot express (hsx)
>>> http://hg.openjdk.java.net/hsx/hotspot-comp/hotspot/
>>>
>>> Here are the result when running PHP.reboot on fibonacci
>>> (-server is the server VM of jdk1.7.0):
>>>
>>> Java:
>>> java -server bigfibo 4.45 s
>>> java -hsx bigfibo 4.44 s
>>>
>>> PHP.reboot (no type annotation)
>>> phpr.sh -server bigfibo 22.72 s
>>> phpr.sh -hsx bigfibo 13.61 s
>>>
>>> PHP.reboot (type specialization)
>>> phpr.sh -server bigfibo 11.09 s
>>> phpr.sh -hsx bigfibo 8.06 s
>>>
>>> PHP.reboot (user defined type annotation)
>>> phpr.sh -server bigfibo2 6.96 s
>>> phpr.sh -hsx bigfibo2 4.21 s
>>>
>>> PHP.reboot is an hybrid runtime, it starts with an interpreter
>>> that walks the AST (really slow) and then compile to bytecode.
>>>
>>> The first test is with no type information provided by the user,
>>> so all variables are object and invokedynamic is used for the
>>> operations, the comparison and for function calls.
>>> As you see, there is a huge speedup.
>>>
>>> The second test enables a flag that ask the runtime to try to
>>> specialize the function at runtime. Because the algorithm
>>> used is a fast-forward typechecker, the parameter of fibo
>>> is san pecialized as int but the return type is still an object
>>> (because fibo is recursive).
>>> So basically here, invokedynamic is used for the function calls
>>> and the + between the results of the function calls.
>>> This '+' is a nasty one because the two parameters are objects,
>>> so it requires a double guards.
>>> You can see the speedup is nice too.
>>>
>>> The third test uses a file that declare the parameter type and
>>> return type of fibo as int, so only the function calls are done
>>> using invokedynamic.
>>> You can also see the speedup and weirdly it's now faster than Java
>>> (not a lot if compare the value but don't forget that
>>> PHP.reboot starts in interpreter mode) so it's clearly faster.
>>> I will take a look to the inlining tree to try to understand why,
>>> it's maybe because fibo is a recursive call or because using
>>> an invokedynamic which is resolved as an invokestatic
>>> enables more inlining than just an invokestatic.
>>>
>>> John, Christian, Tom and all the others of the hotspot-comp team,
>>> you make my day :)
>> These numbers make mine too :-) Thanks for trying the current version.
>
> No, Thank you.
> Frankly, it's amazing to see how something that was at a point only
> in the collective mind of the JSR 292 EG is now real and fast
> thanks to your ability to massage hotspot.
>
>> -- Christian
>
> Rémi
>
> _______________________________________________
> mlvm-dev mailing list
> mlvm-dev at openjdk.java.net
> http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev
>
More information about the mlvm-dev
mailing list