hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jandalf <jsde...@apache.org>
Subject [Patch] HttpStatus optimization
Date Sun, 27 Apr 2003 01:24:22 GMT
Hey Guys,

I did a little optimization on the HttpStatus class.  The old class was 
using a hashtable to map the status codes (integers) to reason phrases 
(strings).  It is unnecessary  to convert the codes to Integer objects 
to use as a key in the hashtable since the status codes map nicely to a 
lookup table.  It was creating a lot of needless objects and was wasting 
space in memory.

Lookups are more than twice as fast now, the memory footprint is 
smaller, and  the static initialization is much faster.  The table size 
needs to be updated if a new status code is added, but it is all in the 
same file and the programmer would be notified on the first test run if 
they neglected it so its a no-brainer.  I took out the logging statement 
as well: there is no reason to log in this class.

This is not commonly used code anyway, I was just scratching an itch. 
 What it really needs is internationalization.

Jandalf.



Mime
  • Unnamed multipart/mixed (inline, None, 0 bytes)
View raw message