You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Brian Pane <bp...@pacbell.net> on 2002/05/02 11:04:55 UTC

[PATCH] optimization for APR sprintf functions

The strncmp() call used to detect quad formatting
directives accounts for about 10% of the execution time
of the apr_*printf() functions.  The static string used
in the comparison typically is only one or two characters
long, so calling a strcmp function is a very heavyweight
way to do the comparison.

This patch replaces the strncmp() with inline comparisons
of the one or two characters comprising the quad format
string.  It works, but it's ugly.

Can anyone suggest a cleaner way of doing this?

--Brian