apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe JAILLET <christophe.jail...@wanadoo.fr>
Subject [PATCH] Reduce apr_[i|l|off_t_]toa memory footprint for common cases
Date Mon, 25 Mar 2013 20:27:13 GMT
Hi list,

I'm currently trying to reduce httpd memory footprint. 
(http://www.mail-archive.com/dev@httpd.apache.org/msg56558.html)

On my test machine, processing a request requires about 15ko in the 
'request' pool. I'm trying to reduce it to only use 8k which is the 
minimum allocated on Linux (min: 2 x 4ko pages)


As a first step, I noticed that apr_itoa, apr_ltoa, apr_off_t_toa could 
be tweaked to require less memory for some common cases.
The attached patch reduces memory use for small values, that is to say 
for strings that fit in 8 bytes (including NULL)


On my system:
apr_itoa allocates 14 (4*3+2) bytes, which gets rounded to 16. A common 
use is for HTTP status code which fits in much less.
--> 8 bytes can be saved in the request pool

apr_off_t_toa allocates 26 (8*3+2) bytes, which gets rounded to 32. A 
common use is for the length of the answer. Common pages are well under 
9.999.999 bytes.
--> 24 bytes can be saved in the request pool


This is not that much, but is a start.

Best regards,
CJ

Mime
View raw message