Python IS slow ! [was] Re: Python too slow for real world

Tim Peters tim_one at email.msn.com
Sat May 8 03:35:04 EDT 1999


[various, about malloc/free performance, Tim points to
    http://starship.python.net/crew/vlad/pymalloc/
]

[Christian Tismer]
> Thanks a lot. Now I have so many ways to go that I cannot
> decide. Vlad uses explicit bins, dedicated storage. While
> this can be very fast, it is a generalization of Guido's
> pre-allocated arrays for some kinds of objects. Nobody
> can tell me if this is the way to go, or if it will
> under circumstances yield much fragmentation.

Vladimir can tell you -- but you have to let him <wink>.  It's A Theorem
that any non-relocating allocator can be provoked into bad fragmentation,
even if the only block sizes ever requested are 1 and 2 (units of your
choice).  Of course some schemes fragment worse than others, but before
worrying about that determine whether fragmentation is a real problem for
Python programs.  Whichever way you answer, it's wrong <wink>.

> ...
> If I knew in advance how long certain objects will live,
> then I would be able to put them into the proper place.

Yes:  on the stack for starters, and exempted from ref-counting entirely.

For the rest, I defer to Vlad's wise response.  With all due respect, he's
spent more time investigating *Python's* memory behavior than Doug Lea, JC,
you, me and Guido combined.

not-to-mention-larry-wall-ly y'rs  - tim






More information about the Python-list mailing list