------art_9837_29516881.1159134177633
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On 9/24/06, Hal Fulton <hal9000 / hypermetrics.com> wrote:
>
> Zed A. Shaw wrote:
> >
> > A *year* ago?  A whole year?  You mean, I've been having this problem,
> people have denied it was a problem, they've insulted me, they've told me
> I'm full of it for a full on month, called me a liar, large production
> operations have been crashing over it, countless hours were wasted trying to
> fix it...
> >
> > and someone posted a patch over a year ago to fix it that nobody
> bothered to apply?
> >
> > Not only that but Eric improved the performance *and* had a test case
> that demonstrated the performance enhancement *and* Perl has these changes?
> >
> > Please, someone tell me it slipped through the cracks or that Eric is
> wrong (doesn't look like it).
> >
>
> I overlooked this whole thing. Do you mind summarizing what it's all
> about?
>
> FWIW, I've never denied the problem or called you a liar. I'm simply
> unfamiliar with the problem.


 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 *14
a...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 utime7.77, stime38, cutime0, cstime0>

On my patched ruby 1.9 from a year ago, it gives me this:

VmSize:     3632 kB
#<struct Struct::Tms utime03, stime0, cutime0, cstime0>

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.

------art_9837_29516881.1159134177633--