apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <d...@arctic.org>
Subject Re: [PATCH] performance fixes for number formatting
Date Tue, 17 Jul 2001 23:41:38 GMT
you might want to disassemble the functions in gdb (or using objdump) to
make sure that gcc emits a single division instruction for the "x / 10",
"x % 10" expressions -- i forget the cases where it can and can't do this.
the low level div instruction is a two result opcode, quotient and
remainder.  if it isn't doing it, then figure out how to make it do that
and you'll see even more improvement :)

(the ancient reason for the ldiv() function was to get at both results
without the compiler being smart enough to figure it out itself.)


On Sun, 15 Jul 2001, Brian Pane wrote:

> In profiling the httpd, I've found the conv_10 function
> (used in the implementation of "%d" for the apr_*printf
> functions) to be one of the top 10 consumers of user-mode
> CPU time.  There are a small number of places in the httpd
> that cause most of the calls to this function.
> The attached patch fixes the problem.  It includes two
> changes to APR:
>   * new functions apr_itoa, apr_ltoa, and apr_off_t_toa
>     that provide itoa-type functionality based on pools
>   * Inline code in inet_ntop4 to replace sprintf for converting
>     binary IP addresses into dotted-decimal format
> and two changes to Apache:
>   * use the apr_itoa functions in setting the content length,
>     in place of apr_psprintf
>   * use the apr_itoa functions to replace frequent uses of
>     'sprintf("%d",...)' in mod_log_config.
> --Brian

View raw message