httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52656] New: Code clean up (remove useless tests)
Date Mon, 13 Feb 2012 16:25:15 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52656

             Bug #: 52656
           Summary: Code clean up (remove useless tests)
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Platform: PC
        OS/Version: Windows 2000
            Status: NEW
          Severity: minor
          Priority: P2
         Component: All
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: christophe.jaillet@wanadoo.fr
    Classification: Unclassified


Created attachment 28320
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=28320
Proposed patch

Hi,

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

The first test against *l is IMO useless and could be removed in order to
improve the generated code.
I.e. :
   while (apr_isspace(*l)) {
       ++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.


The proposed patch removes these, IMO, useless tests.
The modified files are :

 modules/cache/cache_storage.c     |    2 +-
 modules/cache/mod_cache_disk.c    |    2 +-
 modules/cache/mod_disk_cache.c    |    2 +-
 modules/filters/mod_proxy_html.c  |    2 +-
 modules/mappers/mod_imagemap.c    |    2 +-
 modules/mappers/mod_negotiation.c |    8 ++++----
 modules/mappers/mod_rewrite.c     |    2 +-
 modules/metadata/mod_cern_meta.c  |    2 +-
 modules/metadata/mod_headers.c    |    2 +-
 modules/metadata/mod_mime_magic.c |    2 +-
 modules/proxy/mod_proxy_http.c    |    2 +-
 server/util.c                     |    8 ++++----
 server/util_script.c              |    2 +-
 support/httxt2dbm.c               |    2 +-
 14 files changed, 20 insertions(+), 20 deletions(-)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message