On 2/10/06, Ruby Quiz <james / grayproductions.net> wrote:
> This week's Ruby Quiz is to write FasterGenerator, your own
> re-implementation of Generator with an eye towards working faster.

Here's the benchmark results from my own implementation:

galadriel:~/ruby/qotw/66$ ruby benchmark.rb

### Construction ###

Rehearsal -------------------------------------------------------------
Old callcc Generator        7.380000   1.000000   8.380000 (  8.726668)
lukfugl's FasterGenerator   0.020000   0.000000   0.020000 (  0.070048)
---------------------------------------------------- total: 8.400000sec

                                user     system      total        real
Old callcc Generator        8.580000   0.960000   9.540000 (  9.765350)
lukfugl's FasterGenerator   0.020000   0.000000   0.020000 (  0.020035)

### next() ###

Rehearsal -------------------------------------------------------------
Old callcc Generator       10.750000  17.010000  27.760000 ( 28.587567)
lukfugl's FasterGenerator   0.680000   0.000000   0.680000 (  0.744570)
--------------------------------------------------- total: 28.440000sec

                                user     system      total        real
Old callcc Generator       11.490000  17.390000  28.880000 ( 29.853396)
lukfugl's FasterGenerator   0.650000   0.000000   0.650000 ( 
0.694442)

My machine is obviously painfully slower than James', and it looks
like my implementation isn't quite as quick as his, but it was fun
figuring out a few tricks. Now I'm gonna go look at the new code and
see if my implementation beats it too!

(I'll post my solution after the spoiler period expires tomorrow morning.)

Jacob Fugal