From: Joe Van Dyk Date: 2005-07-13T14:53:39+09:00 Subject: Re: Updating GUIs On 7/12/05, Daniel Brockman wrote: > Joe Van Dyk writes: > > > On 7/12/05, Daniel Brockman wrote: > >> Joe Van Dyk writes: > >> > >>> player.polygon = player.polygon.collect do |x,y| > >> > >> How about this? > >> > >> player.polygon.collect! do |x,y| > > > > Didn't increase speed at all. > > Hmm, okay. > > > Is there some Ruby idiom for going through every element in an array > > and destructively changing the values in it? Using collect! didn't > > seem to help at all. > > Well, that *is* how you destructively change each element. > > I guess the array consing wasn't your bottleneck. I'd look at your > algorithm more closely if I weren't so damn tired --- sorry. But in each polygon array, there's 30 arrays that contain the x/y points of the polygon. So I'm creating 40 points per polygon times 500 players = 2000 created arrays on each update. Probably not the most efficient thing to do.