itoa'd you so?
dave at thesmithfam.org
Thu Sep 20 13:41:36 MDT 2007
Derek Davis wrote:
> Why not. I'll post my answer just since it came out faster than
> sprintf. Well, when I pass in a buffer, rather than allocating it in
> the function. Don't know about the speed comparison when allocating.
> Not that this answers your question...
Yes, it turns out that using log10() is the slow point. Floating point
math must be a lot slower than I thought. I wrote and used this
integer-based log10 function function instead and now my code is about
twice as fast as sprintf(). Yay.
int log10i( unsigned int i )
int ret = 0;
while( i )
i /= 10;
More information about the PLUG