printf() radix conversions
Posted on 2003-10-29
What algorithm does printf use to convert integers to radix 16? printf must evaluate its input string, find the variable in its va_list, convert it into hex, and format it somewhere along the way. I would have thought that I could write my own conversion that would be faster as I don't need the format string and the va stuff. However, I keep finding that printf outperforms my algorithms by roughly .2 seconds when outputing 9000+ shorts. What is printf doing? Is it possible that the compiler's author(s) used asm code to get the speed or am I missing something?