httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christophe JAILLET <>
Subject [RFC] speedup some tests in httpd
Date Sun, 12 Feb 2012 07:59:47 GMT

In many places of httpd, we are skipping white spaces with code that 
looks like :
    while (*l && apr_isspace(*l)) {

The first test against *l is IMO useless and could be removed in order 
to improve the generated code.
    while (apr_isspace(*l)) {
apr_isspace is in fact turned to a call to isspace by the apr library 
and isspace(0) returns 0.

I also made some measurement.
The version with the test against *l is faster ONLY when the string to 
scan is EMPTY. In this case it is more or less 50% faster to completely 
avoid the call to isspace.
In ALL other cases, removing the first test is about 15% faster.

I have spotted more or less 20 of these in the code and I could provide 
a patch in bugzilla to remove these useless tests if you think it is useful.

Thanks for your feed back.
Best regards,

Christophe Jaillet

View raw message