performance overhead when allocating many small buffers with the pool

Igor Sysoev is at rambler-co.ru
Sun Oct 14 22:53:44 MSD 2007


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

> 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.

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


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list