Eric Mahurin wrote: > > Take a look at the thread I mentioned on ruby-core from a year ago. It > gives a lot of details. If you want to see an extreme example of the > problem, try this (sorry, linux only for memory measurements): > > n=2**14 > a=(0...n).to_a > (n-1).times{ a[0,2] = [a[0,2]] } > IO.readlines("/proc/#{Process.pid}/status").grep(/VmSize/).display > puts(Process.times) > > In ruby 1.8.4, the above gives me this: > > VmSize: 528236 kB > #<struct Struct::Tms utime=37.77, stime=1.38, cutime=0.0, cstime=0.0> > > On my patched ruby 1.9 from a year ago, it gives me this: > > VmSize: 3632 kB > #<struct Struct::Tms utime=0.03, stime=0.0, cutime=0.0, cstime=0.0> > > If you try this with different values of n, you'll see O(n**2) memory and > runtime, whereas my patch gives O(n) memory and runtime. > > The end_test.rb I posted gives a bunch of cases that should have O(n) > memory > and runtime IMHO, but don't always on ruby 1.8 and 1.9. You'll need to > delete some tests for ruby 1.8, because they have some 1.9-only stuff. > That sounds like a performance issue, but this thread title says 'bug.' Is there really a bug or not? Hal