Re: MethodHandle lookup&invocation performance

2011-07-11 Thread Hervé Girod
That's great then! I will try to inokedynamicize my code soon to see what I could gain ;) Herve Sent from my iPhone On 11 juil. 2011, at 15:36, Rémi Forax wrote: > On 07/11/2011 03:34 PM, Hervé Girod wrote: >> Hello, >> >> My comprehension is that the lookup can be performed only once, to ge

Auto Reply: Re: MethodHandle lookup&invocation performance

2011-07-11 Thread bertrand . delsart
Sorry, I'm away till August 1st. For urgent matters, please contact David.Therkelsen ___ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Re: MethodHandle lookup&invocation performance

2011-07-11 Thread Rémi Forax
On 07/11/2011 03:17 PM, Christian Thalinger wrote: > On Jul 9, 2011, at 3:27 PM, Hiroshi Nakamura wrote: >> Hello, >> >> Thanks for you comments. >> >> On Sat, Jul 9, 2011 at 19:01, Jochen Theodorou wrote: Code is here: https://raw.github.com/nahi/jsr292-sandbox/master/src/jp/gr/java_con

Re: MethodHandle lookup&invocation performance

2011-07-11 Thread Rémi Forax
On 07/11/2011 03:34 PM, Hervé Girod wrote: > Hello, > > My comprehension is that the lookup can be performed only once, to get the > MethodHandle, and that checks are done there and not after when using the > MethodHandle anymore. Am I right? Yes ! Rémi > Sent from my iPhone > > On 11 juil. 20

Re: MethodHandle lookup&invocation performance

2011-07-11 Thread Hervé Girod
Hello, My comprehension is that the lookup can be performed only once, to get the MethodHandle, and that checks are done there and not after when using the MethodHandle anymore. Am I right? Sent from my iPhone On 11 juil. 2011, at 15:17, Christian Thalinger wrote: > On Jul 9, 2011, at 3:27

Re: MethodHandle lookup&invocation performance

2011-07-11 Thread Christian Thalinger
On Jul 9, 2011, at 3:27 PM, Hiroshi Nakamura wrote: > Hello, > > Thanks for you comments. > > On Sat, Jul 9, 2011 at 19:01, Jochen Theodorou wrote: >>> Code is here: >>> https://raw.github.com/nahi/jsr292-sandbox/master/src/jp/gr/java_conf/jruby/MethodHandleTest.java >> >> lookup I don't know.

Re: MethodHandle lookup&invocation performance

2011-07-10 Thread Alexander Turner
Remi, OK - that is quite amazing! Thanks for the explanation. - AJ On 10 July 2011 11:29, Rémi Forax wrote: > On 07/10/2011 10:14 AM, Alexander Turner wrote: >> John, >> >> Thanks for your fascinating reply. I would just like to clarify something: >> >> " >> Another use case which benefits fro

Re: MethodHandle lookup&invocation performance

2011-07-10 Thread Rémi Forax
On 07/10/2011 10:14 AM, Alexander Turner wrote: > John, > > Thanks for your fascinating reply. I would just like to clarify something: > > " > Another use case which benefits from this particular optimization > trick is "static final" method handles. I.e., if you want to get > invokedynamic-like p

Re: MethodHandle lookup&invocation performance

2011-07-10 Thread Alexander Turner
John, Thanks for your fascinating reply. I would just like to clarify something: " Another use case which benefits from this particular optimization trick is "static final" method handles. I.e., if you want to get invokedynamic-like performance in plain Java code, consider doing your work by inv

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread John Rose
On Jul 9, 2011, at 7:13 AM, Alexander Turner wrote: > I am Alex Turner - I was working on a COBOL to JVM compiler and am now > helping with a Magik to JVM compiler. I thought I might just confirm > that invokeExact has proven a lt ot quicker than invoke in our tests. > We have also noticed that us

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Rémi Forax
As Jochen says, package java.lang.invoke is optimized to make invokeExact fast (especially with primitive), not lookup.findVirtual, asType, bindTo etc. The difference between reflection and method handle is when the security check occurs. lookup.findVirtual does the security check and invoke/inv

Auto Reply: Re: MethodHandle lookup&invocation performance

2011-07-09 Thread bertrand . delsart
Sorry, I'm away till August 1st. For urgent matters, please contact David.Therkelsen ___ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Alexander Turner
Hi, I am Alex Turner - I was working on a COBOL to JVM compiler and am now helping with a Magik to JVM compiler. I thought I might just confirm that invokeExact has proven a lt ot quicker than invoke in our tests. We have also noticed that using a method adapter to convert argument counts makes th

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Hiroshi Nakamura
Hello, Thanks for you comments. On Sat, Jul 9, 2011 at 19:01, Jochen Theodorou wrote: >> Code is here: >> https://raw.github.com/nahi/jsr292-sandbox/master/src/jp/gr/java_conf/jruby/MethodHandleTest.java > > lookup I don't know. I am not sure about the recent versions, I think > the lookup is us

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Hiroshi Nakamura
Hello, Thanks for your swift responses. On Sat, Jul 9, 2011 at 19:29, Rémi Forax wrote: >> You should avoid to create constants more than once. Indeed. I updated the benckmark. (please see below) >> Also, bindTo() will create a method handle for-each call. Sure, but 'bindTo(rec).invokeExact(a

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Rémi Forax
On 07/09/2011 12:21 PM, Rémi Forax wrote: > You should avoid to create constants more than once. > Also, bindTo() will create a method handle for-each call. > > You can transform your code like that: > > private static final MethodHandles.Lookup lookup = > MethodHandles.lookup(); > pri

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Rémi Forax
You should avoid to create constants more than once. Also, bindTo() will create a method handle for-each call. You can transform your code like that: private static final MethodHandles.Lookup lookup = MethodHandles.lookup(); private static final MethodType mt = MethodType.methodType(Str

Auto Reply: Re: MethodHandle lookup&invocation performance

2011-07-09 Thread bertrand . delsart
Sorry, I'm away till August 1st. For urgent matters, please contact David.Therkelsen ___ mlvm-dev mailing list [email protected] http://mail.openjdk.java.net/mailman/listinfo/mlvm-dev

Re: MethodHandle lookup&invocation performance

2011-07-09 Thread Jochen Theodorou
Am 09.07.2011 10:48, schrieb Hiroshi Nakamura: > Hello, > > I heard that jsr292 makes dynamic method lookup&invocation faster than > reflection so I did some performance comparison against plain > reflection. I'm sending this mail since the result looks strange to > me. > > Code is here: > https://