Performance overhead when allocating many small buffers with the pool

Hi.

In my mod_wsgi implementation (function wsgi_build_environment) I need
to copy each of the HTTP header and wsgi params in Python objects.

In the current implementation I just allocate a buffer, copy the content
in it, and then create a Python String object.

I’m assuming that using an allocator pool, allocating small buffers is
cheap, but I would like a confirmation.

An alternative implementation is to allocate only one buffer, using the
max lenght required, and reusing it for every Python object.

Thanks Manlio P.

On Sun, Oct 14, 2007 at 08:33:44PM +0200, Manlio P. wrote:

An alternative implementation is to allocate only one buffer, using the
max lenght required, and reusing it for every Python object.

It’s cheap, however, I use both ways depending on situation.