JRuby/Seph/PHP.reboot/... SwitchPoint usage
Charles Oliver Nutter
headius at headius.com
Mon Aug 8 09:39:37 PDT 2011
On Mon, Aug 8, 2011 at 9:51 AM, Christian Thalinger
<christian.thalinger at oracle.com> wrote:
> Since I have the basic push-notification of CallSites I'm now looking into push-notification of SwitchPoints:
>
> 7071709: JSR 292: switchpoint invalidation should be pushed not pulled
>
> Basically it should be the same, just needs some additional love in the compiler.
>
> I looked into JRuby's usage of SwitchPoints and it seems it has something to do with constants. Is there an existing benchmark that would benefit from the SwitchPoint optimization? Seph also seems to use SwitchPoints, PHP.reboot does not (that's what grep tells me).
Yes, currently SwitchPoint is only used for constant lookup, since
constant modification invalidates globally. A good benchmark to use
would be this one:
bench/language/bench_const_lookup.rb <number of iters>
Here's numbers with a recent openjdk-osx-build with and without
invokedynamic enabled
WITHOUT:
100k * 100 nested const get 0.059000 0.000000
0.059000 ( 0.059000)
100k * 100 nested const get 0.059000 0.000000
0.059000 ( 0.059000)
100k * 100 nested const get 0.058000 0.000000
0.058000 ( 0.058000)
100k * 100 nested const get 0.059000 0.000000
0.059000 ( 0.059000)
100k * 100 nested const get 0.057000 0.000000
0.057000 ( 0.057000)
100k * 100 inherited const get 0.058000 0.000000
0.058000 ( 0.058000)
100k * 100 inherited const get 0.059000 0.000000
0.059000 ( 0.059000)
100k * 100 inherited const get 0.058000 0.000000
0.058000 ( 0.058000)
100k * 100 inherited const get 0.058000 0.000000
0.058000 ( 0.058000)
100k * 100 inherited const get 0.063000 0.000000
0.063000 ( 0.064000)
100k * 100 both 0.060000 0.000000
0.060000 ( 0.060000)
100k * 100 both 0.060000 0.000000
0.060000 ( 0.060000)
100k * 100 both 0.059000 0.000000
0.059000 ( 0.059000)
100k * 100 both 0.058000 0.000000
0.058000 ( 0.058000)
100k * 100 both 0.059000 0.000000
0.059000 ( 0.059000)
WITH: (specify -Xinvokedynamic.constants=true to JRuby, or
-Djruby.invokedynamic.constants=true to JVM)
100k * 100 nested const get 1.321000 0.000000
1.321000 ( 1.321000)
100k * 100 nested const get 1.311000 0.000000
1.311000 ( 1.311000)
100k * 100 nested const get 1.305000 0.000000
1.305000 ( 1.305000)
100k * 100 nested const get 1.293000 0.000000
1.293000 ( 1.294000)
100k * 100 nested const get 1.292000 0.000000
1.292000 ( 1.293000)
100k * 100 inherited const get 1.295000 0.000000
1.295000 ( 1.295000)
100k * 100 inherited const get 1.241000 0.000000
1.241000 ( 1.241000)
100k * 100 inherited const get 1.241000 0.000000
1.241000 ( 1.241000)
100k * 100 inherited const get 1.244000 0.000000
1.244000 ( 1.244000)
100k * 100 inherited const get 1.236000 0.000000
1.236000 ( 1.236000)
100k * 100 both 1.280000 0.000000
1.280000 ( 1.280000)
100k * 100 both 1.236000 0.000000
1.236000 ( 1.236000)
100k * 100 both 1.229000 0.000000
1.229000 ( 1.230000)
100k * 100 both 1.236000 0.000000
1.236000 ( 1.236000)
100k * 100 both 1.248000 0.000000
1.248000 ( 1.248000)
You can see there's some room for improvement :) The number should be
faster with invokedynamic, since the SwitchPoint form has no active
guard.
- Charlie
More information about the mlvm-dev
mailing list