Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Bugs

[Bug 52656] New: Code clean up (remove useless tests)

 

 

Apache bugs RSS feed   Index | Next | Previous | View Threaded


bugzilla at apache

Feb 13, 2012, 8:25 AM

Post #1 of 1 (102 views)
Permalink
[Bug 52656] New: Code clean up (remove useless tests)

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 [at] httpd
ReportedBy: christophe.jaillet [at] wanadoo
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 [at] httpd
For additional commands, e-mail: bugs-help [at] httpd

Apache bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.