On 26 Jul 2007 23:35:44 -0700, Paul Rubin <"http://phr.cx"@nospam.invalid> wrote: > Peter Otten <[EMAIL PROTECTED]> writes: > > When you are allocating a lot of objects without releasing them the garbage > > collector kicks in to look for cycles. Try switching it off: > > I think that is the answer. The zip took almost 2 minutes without > turning gc off, but takes 1.25 seconds with gc off. It turned a > linear-time algorithm into a quadratic one. I think something is > broken about a design where that can happen. Maybe Pypy will have > a generational GC someday. > --
Better hand in your computer, then. You're never going to find a situation where the environment won't affect the running time of your algorithms. For the record, the python GC is generational. This is a case of a default heuristic giving pathological behavior in a corner case, not anything broken about the design of the python GC. > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list