# SyncEnumerator

**URL:** <https://rubytalk.org/t/syncenumerator/14590>\
**Category:** ruby-talk\
**Created:** [4 November 2004 12:28 UTC](https://rubytalk.org/t/syncenumerator/14590 "2004-11-04T12:28:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian\_Gross](https://avatars.discourse-cdn.com/v4/letter/f/e9a140/32.png) [@Florian\_Gross](https://rubytalk.org/u/Florian_Gross)\
**Post date:** [4 November 2004 12:28 UTC](https://rubytalk.org/t/syncenumerator/14590/1 "2004-11-04T12:28:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Mark\_Hubbart1](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Mark\_Hubbart1](https://rubytalk.org/u/Mark_Hubbart1)\
**Post date:** [5 November 2004 21:27 UTC](https://rubytalk.org/t/syncenumerator/14590/2 "2004-11-05T21:27:10Z")

</div>

Hi,

> 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?

Hmm... I don't have the OP's message in my archives...  
Assuming it's a transparent change, improving performance without  
breaking code, why not just submit it to ruby-core? People are always  
posting bug patches there, I suspect that a performance patch wouldn't  
be unwelcome.

cheers,  
Mark

> **···**
>
> On Thu, 4 Nov 2004 21:28:45 +0900, Florian Gross \<flgr@ccan.de\> wrote:

---

<div class="post-metadata">

**Author:** ![Tom\_Copeland](https://avatars.discourse-cdn.com/v4/letter/t/94ad74/32.png) [@Tom\_Copeland](https://rubytalk.org/u/Tom_Copeland)\
**Post date:** [5 November 2004 21:32 UTC](https://rubytalk.org/t/syncenumerator/14590/3 "2004-11-05T21:32:07Z")

</div>

Or better still, file it here:

[http://rubyforge.org/tracker/?atid=1700&group\_id=426&func=browse](http://rubyforge.org/tracker/?atid=1700&group_id=426&func=browse)

That'll send an email of the patch summary and description to ruby-core  
as well. Also, then you can post updated version of the patch as you  
get feedback, and other folks will be able to monitor the patch and get  
notified of the updates.

Yours,

tom

> **···**
>
> On Fri, 2004-11-05 at 16:27, Mark Hubbart wrote:
> 
> > Assuming it's a transparent change, improving performance without  
> > breaking code, why not just submit it to ruby-core? People are always  
> > posting bug patches there, I suspect that a performance patch wouldn't  
> > be unwelcome.

---

<div class="post-metadata">

**Author:** ![SER](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@SER](https://rubytalk.org/u/SER)\
**Post date:** [7 November 2004 02:52 UTC](https://rubytalk.org/t/syncenumerator/14590/4 "2004-11-07T02:52:59Z")

</div>

I've been a member of the Ruby community for I don't know how long now, and I  
\*still\* haven't figured out when a patch should be submitted to ruby-core,  
and when to RCR. :-/

> **···**
>
> On Friday 05 November 2004 16:32, Tom Copeland wrote:
> 
> > On Fri, 2004-11-05 at 16:27, Mark Hubbart wrote:  
> > \> Assuming it's a transparent change, improving performance without  
> > \> breaking code, why not just submit it to ruby-core? People are always  
> > \> posting bug patches there, I suspect that a performance patch wouldn't  
> > \> be unwelcome.
> > 
> > Or better still, file it here:
> > 
> > [http://rubyforge.org/tracker/?atid=1700&group\_id=426&func=browse](http://rubyforge.org/tracker/?atid=1700&group_id=426&func=browse)
> > 
> > That'll send an email of the patch summary and description to ruby-core  
> > as well. Also, then you can post updated version of the patch as you  
> > get feedback, and other folks will be able to monitor the patch and get  
> > notified of the updates.
> 
> --  
> ### SER  
> ### Deutsch|Esperanto|Francaise|Linux|XML|Java|Ruby|Aikido  
> ### [http://www.germane-software.com/~ser](http://www.germane-software.com/~ser) jabber.com:ser ICQ:83578737  
> ### GPG: [http://www.germane-software.com/~ser/Security/ser\_public.gpg](http://www.germane-software.com/~ser/Security/ser_public.gpg)

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [7 November 2004 12:32 UTC](https://rubytalk.org/t/syncenumerator/14590/5 "2004-11-07T12:32:41Z")

</div>

Hi,

> **···**
>
> In message "Re: SyncEnumerator" on Sun, 7 Nov 2004 11:52:59 +0900, "Sean E. Russell" \<ggg@ser1.net\> writes:
> 
> > I've been a member of the Ruby community for I don't know how long now, and I  
> > \*still\* haven't figured out when a patch should be submitted to ruby-core,  
> > and when to RCR. :-/
> 
> If you think the change is to fix the bug (i.e. difference from the  
> behavior you assume I (matz) expect), send it to the ruby-core list.  
> If the change is to make Ruby better in your point of view, submit  
> RCR, then raise the discussion on the list.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

---

<div class="post-metadata">

**Author:** ![David\_A\_Black3](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David\_A\_Black3](https://rubytalk.org/u/David_A_Black3)\
**Post date:** [7 November 2004 14:08 UTC](https://rubytalk.org/t/syncenumerator/14590/6 "2004-11-07T14:08:28Z")

</div>

Hi --

> **···**
>
> On Sun, 7 Nov 2004, Yukihiro Matsumoto wrote:
> 
> > Hi,
> > 
> > In message "Re: SyncEnumerator" \> on Sun, 7 Nov 2004 11:52:59 +0900, "Sean E. Russell" \<ggg@ser1.net\> writes:
> > 
> > \>I've been a member of the Ruby community for I don't know how long now, and I  
> > \>\*still\* haven't figured out when a patch should be submitted to ruby-core,  
> > \>and when to RCR. :-/
> > 
> > If you think the change is to fix the bug (i.e. difference from the  
> > behavior you assume I (matz) expect), send it to the ruby-core list.  
> > If the change is to make Ruby better in your point of view, submit  
> > RCR, then raise the discussion on the list.
> 
> I've been a member of the Ruby community for four years (minus roughly  
> 13 hours; my first post to ruby-talk was November 7, 2000, at 21:52  
> EST 🙂 and one thing I'm not sure of is.....
> 
> To what extent should RCR discussion be here, and to what extent  
> should it be on the message/comment space on RCRchive?
> 
> David
> 
> --  
> David A. Black  
> dblack@wobblini.net

---

<div class="post-metadata">

**Author:** ![gabriele\_renzi](https://avatars.discourse-cdn.com/v4/letter/g/e19b73/32.png) [@gabriele\_renzi](https://rubytalk.org/u/gabriele_renzi)\
**Post date:** [7 November 2004 19:08 UTC](https://rubytalk.org/t/syncenumerator/14590/7 "2004-11-07T19:08:36Z")

</div>

Yukihiro Matsumoto ha scritto:  
n to RCR. :-/

> If you think the change is to fix the bug (i.e. difference from the  
> behavior you assume I (matz) expect), send it to the ruby-core list.  
> If the change is to make Ruby better in your point of view, submit  
> RCR, then raise the discussion on the list.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

but /just/ making something faster seems a ruby-core thing, cause it is better in everyone's point of view (well, except for making sleep() faster)

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [7 November 2004 15:10 UTC](https://rubytalk.org/t/syncenumerator/14590/8 "2004-11-07T15:10:59Z")

</div>

Hi,

> To what extent should RCR discussion be here, and to what extent  
> should it be on the message/comment space on RCRchive?

I prefer discussion on the list, especially for more something than  
simple discussion.

&nbsp;&nbsp;\* wider range of opinion can be gathered.  
&nbsp;&nbsp;\* I prefer push model of mail lists to web's pull model.  
&nbsp;&nbsp;\* summaries are often better organized on the web discussion,  
&nbsp;&nbsp;&nbsp;&nbsp;though.

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

> **···**
>
> In message "Re: RCR discussions (was: Re: SyncEnumerator)" on Sun, 7 Nov 2004 23:08:28 +0900, "David A. Black" \<dblack@wobblini.net\> writes:

---

<div class="post-metadata">

**Author:** ![Jim\_Weirich1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jim\_Weirich1](https://rubytalk.org/u/Jim_Weirich1)\
**Post date:** [7 November 2004 18:06 UTC](https://rubytalk.org/t/syncenumerator/14590/9 "2004-11-07T18:06:56Z")

</div>

> I've been a member of the Ruby community for four years (minus roughly  
> 13 hours; my first post to ruby-talk was November 7, 2000, at 21:52  
> EST 🙂

Wow, how time flies!

> and one thing I'm not sure of is.....
> 
> To what extent should RCR discussion be here, and to what extent  
> should it be on the message/comment space on RCRchive?

If you have a glimmer of an RCR, and have done your research (at least googled  
the topic on the mail list), the the mailing list is a good place to solicite  
feedback. Hopefully the research step will get you beyond the topics that  
have been hashed out over and over (and over and over and ... well, you get  
the idea).

You can read: [http://onestepback.org/index.cgi/Tech/Ruby/WritingRcrs.rdoc](http://onestepback.org/index.cgi/Tech/Ruby/WritingRcrs.rdoc) for  
a longer rant on this topic.

> **···**
>
> On Sunday 07 November 2004 09:08 am, David A. Black wrote:
> 
> --  
> -- Jim Weirich jim@weirichhouse.org [http://onestepback.org](http://onestepback.org)  
> -----------------------------------------------------------------  
> "Beware of bugs in the above code; I have only proved it correct,  
> not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

---

<div class="post-metadata">

**Author:** ![Yukihiro\_Matsumoto2](https://avatars.discourse-cdn.com/v4/letter/y/b9e5f3/32.png) [@Yukihiro\_Matsumoto2](https://rubytalk.org/u/Yukihiro_Matsumoto2)\
**Post date:** [7 November 2004 22:49 UTC](https://rubytalk.org/t/syncenumerator/14590/10 "2004-11-07T22:49:10Z")

</div>

Hi,

> **···**
>
> In message "Re: SyncEnumerator" on Mon, 8 Nov 2004 04:08:36 +0900, gabriele renzi \<rff\_rff@remove-yahoo.it\> writes:
> 
> > but /just/ making something faster seems a ruby-core thing, cause it is  
> > better in everyone's point of view (well, except for making sleep() faster)
> 
> I thing making something faster without changing behavior would do  
> nothing with RCR from the beginning.
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;matz.

---

<div class="post-metadata">

**Author:** ![David\_A\_Black3](https://avatars.discourse-cdn.com/v4/letter/d/6a8cbe/32.png) [@David\_A\_Black3](https://rubytalk.org/u/David_A_Black3)\
**Post date:** [7 November 2004 18:33 UTC](https://rubytalk.org/t/syncenumerator/14590/11 "2004-11-07T18:33:44Z")

</div>

Hi --

> \> I've been a member of the Ruby community for four years (minus roughly  
> \> 13 hours; my first post to ruby-talk was November 7, 2000, at 21:52  
> \> EST 🙂
> 
> Wow, how time flies!
> 
> \> and one thing I'm not sure of is.....  
> \>  
> \> To what extent should RCR discussion be here, and to what extent  
> \> should it be on the message/comment space on RCRchive?
> 
> If you have a glimmer of an RCR, and have done your research (at least googled  
> the topic on the mail list), the the mailing list is a good place to solicite  
> feedback. Hopefully the research step will get you beyond the topics that  
> have been hashed out over and over (and over and over and ... well, you get  
> the idea).

I would also emphasize the importance of reading the rejected RCRs on  
RCRchive, along with the list archives.

> You can read: [http://onestepback.org/index.cgi/Tech/Ruby/WritingRcrs.rdoc](http://onestepback.org/index.cgi/Tech/Ruby/WritingRcrs.rdoc) for  
> a longer rant on this topic.

I've read it -- actually it's been linked in to RCRchive as required  
reading from the beginning 🙂

It just seems there are different scenarios in practice: submitting at  
RCRchive first, then discussing here (which the scenario Matz was  
endorsing this morning), discussing first and then submitting (which  
happens a lot, even unendorsed :-), submitting and using the comment  
space on RCRchive, etc. I guess it's partly that discussion in any  
forum sometimes happens to move toward discussion of possible language  
changes, so in that sense pre-RCR discussion happens spontaneously.  
(And it may not matter too much, as long as the basic tenets of  
non-rehashing and non-resubmission of rejected ideas are followed.)

David

> **···**
>
> On Mon, 8 Nov 2004, Jim Weirich wrote:
> 
> > On Sunday 07 November 2004 09:08 am, David A. Black wrote:
> 
> --  
> David A. Black  
> dblack@wobblini.net
