Newbie jumping in here.

On Feb 10, 2006, at 17:23 , James Edward Gray II wrote:

> On Feb 10, 2006, at 10:08 AM, Matthew Moss wrote:
>
>> Not being familiar with all the various Ruby packages and libs, I
>> first want to thank ya for posting a good set of test cases that I  
>> can
>> review, but was wondering if you also might post the code used to do
>> the timing?
>
> I will, yes, on Sunday.  :)
>
> I pulled down copies on the Generator library, before and after the  
> change.  I then modified the class names so they could all  
> peacefully coexist, loaded them, and ran a trivial benchemark:
>

...snip..

> Benchmark.bmbm do |x|
>   x.report("Current Generator") do
>     generator = CurrentGenerator.new(enum)
>     tests.times { generator.next until generator.end? }
>   end

I have small problem with this. Won't this mean the loop will only  
run 1 time?

The first time it correctly loops, but the next time "generator.end?"  
will be true, and the following 999 runs will consequently does not  
execute generator.next at all, right?

If we change the row to

test.times do
   generator.rewind
   generator.next until generator.end?
end

Isn't that giving us the desired test-behaviour?


/Christoffer