Fiber performance in 1.9.2-p290 vs -p180

I wrote a simple Fiber benchmark (based on an earlier one I found).
I ran it one MRI ruby 1.9.2-p180 and -p290. The performance
difference was dramatic. p290 executed the benchmark 25-50
times faster. I didn’t plot the scaling factor, cuz I don’t know an easy
graph plotting tool.

Does anyone know why there is this dramatic Fiber preformance
difference?

-LLeo

P.S.
The code is attached and on github.com as gist:1108752
Improved Fiber benchmark based on gist: 824294 · GitHub

I ran (on a 2011 MBP w/8gb ram)
% rvm use 1.9.2-p180
% ./fiber_ring.rb 1000 1
1000, 1, 0.010000 0.000000 0.010000 ( 0.012526)
% ./fiber_ring.rb 10_000 1
10000, 1, 3.490000 0.050000 3.540000 ( 3.553194)
% ./fiber_ring.rb 100_000 1
100000, 1, 792.170000 1.370000 793.540000 (792.917801)

and
% rvm use ruby-1.9.2-p290
% ./fiber_ring.rb 1000 1
1000, 1, 0.000000 0.010000 0.010000 ( 0.012345)
% ./fiber_ring.rb 10_000 1
10000, 1, 0.210000 0.040000 0.250000 ( 0.264341)
% ./fiber_ring.rb 100_000 1
100000, 1, 13.910000 0.640000 14.550000 ( 14.664316)

You should note that it’s not running the fibers that’s taking so much
time;
it’s the creation of the fibers that’s taking most of the time.

ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]

10000, 1:
Rehearsal ------------------------------------
Creation: 7.04735
Execution: 0.739264
7.670000 0.080000 7.750000 ( 7.786814)
Creation: 2.846162
Execution: 0.337496
3.110000 0.080000 3.190000 ( 3.183820)
Creation: 2.574672
Execution: 0.176939
2.680000 0.070000 2.750000 ( 2.751769)
-------------------------- total: 13.690000sec

   user     system      total        real

Creation: 1.767601
Execution: 0.217488
1.910000 0.080000 1.990000 ( 1.985250)
Creation: 1.418652
Execution: 0.321165
1.690000 0.050000 1.740000 ( 1.740013)
Creation: 1.733864
Execution: 0.372116
2.040000 0.060000 2.100000 ( 2.106124)

First, thanks for looking at the code.

Later, I played with that after my original post. But even execution
times (rather than
creation+execution) show significant speed up between p180 and p290 .

% rvm use 1.9.2-p180
% ./fiber_ring.rb 20_000 1
creation : 20000, 1, 15.990000 0.070000 16.060000 ( 16.041650)
execution: 20000, 1, 1.300000 0.030000 1.330000 ( 1.355492)

% rvm use 1.9.2-p290
% ./fiber_ring.rb 20_000 1
creation : 20000, 1, 0.480000 0.060000 0.540000 ( 0.534756)
execution: 20000, 1, 0.200000 0.030000 0.230000 ( 0.252246)

It is still 1.35s versus .252s for execution. I am happy and all. I was
hoping someone could point out if it was GC or Fiber optimizations.
I am relatively new to Ruby and I find Fibers facinating. I once
played with continuation type code in a C++ eventloop; like
em-synchrony does.

Thanks,
-LLeo