From: "ara.t.howard" Date: 2008-09-11T05:07:17+09:00 Subject: Re: How to operate on 2 arrays simultaneously? On Sep 10, 2008, at 1:45 PM, Joel VanderWerf wrote: > It's less dramatic when the entries are not nil (or fixnum etc)--I > think that's Matt's point. > > mb = 2 ** 20 > > big = 2 * mb > > a = Array.new big do |i| "the string for entry #{i}" end > b = a.dup > > memory_usage = `ps -o rss= -p #{Process.pid}`.to_i > puts memory_usage > > a.zip(b) > > memory_usage = `ps -o rss= -p #{Process.pid}`.to_i > puts memory_usage > > __END__ > 213256 > 322232 true enough - my point is that the block form is much better when the arrays are big, without it the new array, pointers or not, is created. cheers. a @ http://codeforpeople.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama