Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Micro bench is nearly 2x slower with JIT than interp #2712

Closed
enebo opened this Issue Mar 17, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@enebo
Copy link
Member

enebo commented Mar 17, 2015

system ~/work/jruby master * 4271% jruby -X-C bench/core/basic_object/ivar_access_bench.rb 
jruby -X-C bench/core/basic_object/ivar_access_bench.rb 
Rehearsal --------------------------------------------------------------------
baseline x10000000                 2.580000   0.120000   2.700000 (  1.608183)
single threaded reads x10000000    9.990000   0.020000  10.010000 (  9.649027)
single threaded writes x10000000  11.610000   0.040000  11.650000 ( 11.455932)
two reader threads x10000000      22.030000   0.040000  22.070000 ( 11.191211)
one reader, one writer x10000000  26.520000   0.080000  26.600000 ( 13.956820)
single threaded growth x8000       2.160000   0.070000   2.230000 (  1.814723)
---------------------------------------------------------- total: 75.260000sec

                                       user     system      total        real
baseline x10000000                 1.200000   0.000000   1.200000 (  1.182155)
single threaded reads x10000000   10.120000   0.020000  10.140000 ( 10.119434)
single threaded writes x10000000  11.350000   0.030000  11.380000 ( 11.301783)
two reader threads x10000000      23.920000   0.050000  23.970000 ( 12.157203)
one reader, one writer x10000000  27.460000   0.070000  27.530000 ( 14.543256)
single threaded growth x8000       1.780000   0.020000   1.800000 (  1.493281)
system ~/work/jruby master * 4272% jruby bench/core/basic_object/ivar_access_bench.rb 
jruby bench/core/basic_object/ivar_access_bench.rb 
Rehearsal --------------------------------------------------------------------
baseline x10000000                 1.380000   0.100000   1.480000 (  0.777764)
single threaded reads x10000000   19.040000   0.100000  19.140000 ( 18.597006)
single threaded writes x10000000  17.740000   0.090000  17.830000 ( 17.445109)
two reader threads x10000000      43.660000   0.170000  43.830000 ( 21.853823)
one reader, one writer x10000000  45.240000   0.140000  45.380000 ( 23.344774)
single threaded growth x8000       2.070000   0.030000   2.100000 (  1.778782)
--------------------------------------------------------- total: 129.760000sec

                                       user     system      total        real
baseline x10000000                 0.440000   0.000000   0.440000 (  0.433060)
single threaded reads x10000000   19.030000   0.070000  19.100000 ( 18.911552)
single threaded writes x10000000  17.740000   0.070000  17.810000 ( 17.551971)
two reader threads x10000000      44.170000   0.130000  44.300000 ( 22.425742)
one reader, one writer x10000000  44.830000   0.120000  44.950000 ( 22.704977)
single threaded growth x8000       1.680000   0.020000   1.700000 (  1.532436)
@headius

This comment has been minimized.

Copy link
Member

headius commented Mar 17, 2015

JVM6 JIT is not currently caching the variable accessors, so they're retrieved every time.

@headius

This comment has been minimized.

Copy link
Member

headius commented Mar 17, 2015

Performance of the JVM7 JIT is much faster, as expected.

[] ~/projects/jruby $ jruby -Xcompile.invokedynamic=true bench/core/basic_object/ivar_access_bench.rb 
Rehearsal --------------------------------------------------------------------
baseline x10000000                 1.130000   0.110000   1.240000 (  0.725549)
single threaded reads x10000000    4.480000   0.050000   4.530000 (  3.970895)
single threaded writes x10000000   4.500000   0.030000   4.530000 (  4.418671)
two reader threads x10000000       9.540000   0.060000   9.600000 (  5.238042)
one reader, one writer x10000000  11.350000   0.060000  11.410000 (  5.981547)
single threaded growth x8000       2.240000   0.070000   2.310000 (  1.931214)
---------------------------------------------------------- total: 33.620000sec

                                       user     system      total        real
baseline x10000000                 0.520000   0.010000   0.530000 (  0.526608)
single threaded reads x10000000    3.430000   0.030000   3.460000 (  3.481656)
single threaded writes x10000000   4.780000   0.030000   4.810000 (  4.840172)
two reader threads x10000000       7.510000   0.050000   7.560000 (  3.823658)
one reader, one writer x10000000  10.800000   0.060000  10.860000 (  6.243957)
single threaded growth x8000       1.870000   0.030000   1.900000 (  1.578863)

[] ~/projects/jruby $ jruby -X-C bench/core/basic_object/ivar_access_bench.rb 
Rehearsal --------------------------------------------------------------------
baseline x10000000                 2.500000   0.130000   2.630000 (  1.679575)
single threaded reads x10000000   11.230000   0.090000  11.320000 ( 11.052406)
single threaded writes x10000000  12.840000   0.100000  12.940000 ( 12.837370)
two reader threads x10000000      22.560000   0.130000  22.690000 ( 11.443047)
one reader, one writer x10000000  26.340000   0.170000  26.510000 ( 14.300930)
single threaded growth x8000       2.310000   0.080000   2.390000 (  1.996708)
---------------------------------------------------------- total: 78.480000sec

                                       user     system      total        real
baseline x10000000                 1.260000   0.010000   1.270000 (  1.267530)
single threaded reads x10000000   10.670000   0.080000  10.750000 ( 10.836904)
single threaded writes x10000000  12.240000   0.100000  12.340000 ( 12.356517)
two reader threads x10000000      21.930000   0.140000  22.070000 ( 11.236822)
one reader, one writer x10000000  26.400000   0.180000  26.580000 ( 14.306004)
single threaded growth x8000       1.860000   0.030000   1.890000 (  1.634978)
@headius

This comment has been minimized.

Copy link
Member

headius commented Mar 17, 2015

Oops, actual problem was that symbols were not caching AT ALL. Tons of allocation. Fix coming.

@headius headius closed this in 55b1b9e Mar 17, 2015

@enebo enebo added this to the 9.0.0.0.pre2 milestone Apr 28, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.