Our direct ivar reads/writes are now pretty fast (faster than MRI in
bench_ivar_access, at least on my slowish machine), and attr reads are also
pretty fast (also faster than MRI), especially since Charlie got rid of the
callback.  But attr writes are still painfully slow, and I'm not sure why.
Here are the numbers (from bench_ivar_access.rb):

JRuby:

100k * 100 ivar gets, 1 ivar    1.625000   0.000000   1.625000 (  1.625000)
100k * 100 ivar sets, 1 ivar    2.391000   0.000000   2.391000 (  2.391000)
100k * 100 attr gets, 1 ivar    2.703000   0.000000   2.703000 (  2.703000)
100k * 100 attr sets, 1 ivar    7.516000   0.000000   7.516000 (  7.531000)

MRI:

100k * 100 ivar gets, 1 ivar    2.031000   0.000000   2.031000 (  2.172000)
100k * 100 ivar sets, 1 ivar    2.469000   0.000000   2.469000 (  2.469000)
100k * 100 attr gets, 1 ivar    3.250000   0.000000   3.250000 (  3.281000)
100k * 100 attr sets, 1 ivar    4.204000   0.000000   4.204000 (  4.203000)

Might it have something to do with the reference to self in the call? (I
would think that would be optimized away, but I don't know much about that
end of the code base).  Or something else?

-Bill

Reply via email to