Jonathan Paisley
11/10/2004 12:43:00 PM
On Tue, 09 Nov 2004 22:06:58 +0900, Sean E. Russell wrote:
> On Sunday 07 November 2004 17:49, Yukihiro Matsumoto wrote:
>> I thing making something faster without changing behavior would do
>> nothing with RCR from the beginning.
>
> Ok. Then I'd like to suggest replacing the existing SyncEnumerator in
> Generator.rb with the one I've provided.
Is the SyncEnumerator method 'end?' from the original implementation in
generator.rb part of the public interface? If so, is it okay that the
proposed alternative doesn't provide it?
Another difference that may be worth considering is that the
non-continuation based implementation can't (I think - please correct me
here) handle Enumerables that can only be enumerated once. An example
would be a file, socket or a pipe.
SyncEnumerator1 uses [] to index the Enumerable, so it would be
necessary to update the documentation to explicitly indicate that objects
supporting [] are required. The same applies for the use of the 'size'
method.
SyncEnumerator2 uses zip which converts to arrays internally if necessary.
What are the memory implications of using SyncEnumerator2 as opposed to
the current SyncEnumerator with, for example, two very large files?
I suppose the above boils down to: the SyncEnumerator improvements
primarily apply to array-like objects, so I'd like to see the
Generator-based implementation remain, somewhere.
Thanks.