[Python-checkins] python/dist/src/Objects unicodeobject.c,2.139,2.140

Guido van Rossum guido@python.org
Sun, 21 Apr 2002 19:48:46 -0400


> The only case where your patch is faster is for very short
> strings and then only by a few percent, whereas for all
> longer strings you get worse timings, e.g. 3.74 seconds
> compared to 2.48 seconds -- that's a 50% increase in
> run-time !

First decide what's worse -- overallocating memory or slowing down.
This is not at all clear!  If the normal use case is that strings to
be encoded are significantly smaller than memory, overallocating is
worth it.  If we expect this to happen for strings close to the VM
size, overallocating may cause problems.  Does Linux still have the
problem that its malloc() will let you allocate more memory than the
system has available, and then crash hard when you try to touch all of
it?

--Guido van Rossum (home page: http://www.python.org/~guido/)