httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <>
Subject Re: SGI Patch 10xpatch-2.0a6-5 - eliminate use of sprintf() to format inet_ntoa conversions
Date Fri, 23 Feb 2001 21:24:11 GMT
On Fri, 23 Feb 2001 wrote:

> On Fri, 23 Feb 2001, Bill Stoddard wrote:
> > I know as fact that sprintf() is pure performance evil.  We need to eliminate
> > it everywhere possible in the server. This patch remove two calls to sprintf
> > for each connection.
> >
> > This patch needs to be reworked to fit into inet_ntop.c.  Possibly  Resubmit
> > and I will review and commit it (unless someone else calls out a severe
> > problem that I don;t see).
> Taking a REALLY quick look at the patch and the server, this is overkill.
> We only use inet_ntoa in one place in the server.  For inet_ntop, we only
> use psprintf to translate integers into strings.  What we really need is a
> VERY simple function that given an integer, will turn it into a string.
> This should be a five or six line function, and it can be used everywhere.

there are faster ways to convert an 8-bit integer to a base-10
representation than there are to convert 32-bit integers to base-10.
part of the point of the patch is to take advantage of this fact...
if you can actually convince the compiler to generate an 8-bit division
it'll generally complete faster than the full 32-bit division.

the only way to be sure your general approach is the right one is to
actually benchmark multiple methods.


View raw message