From: Florian Gross Date: 2004-11-04T21:28:45+09:00 Subject: Re: SyncEnumerator Sean Russell wrote: > I was playing around with the SyncEnumerator from Ruby 1.8, and > noticed that it was taking a long time to iterate over elements. > > The current implementation may be the "correct", or elegant, way to > implement it, but it is terribly inefficient. I rewrote the class, > and got the following results: > > Construction > Old: 0.159291 > New: 0.000352 > Starting SyncEnumerator > ................................................................................ > 26 shold be 26 :: Time: 19.686455 > Starting SyncEnumerator_ > ................................................................................ > 26 shold be 26 :: Time: 0.028817 > > The new version is nearly three orders of magnitude faster for > construction, and is three orders of magnitude faster in execution. > > Is there any reason why I shouldn't submit this as an RCR to replace > SyncEnumerator? I wonder how an implementation using .zip with a block would compare? Or would that not do the same thing?