This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Preparsing sprintf format strings

Denys Vlasenko wrote:
> On Monday 08 October 2007 16:08, Heikki Linnakangas wrote:
>> Denys Vlasenko wrote:
>>> In linux kernel, decimal conversion in vsprintf() is optimized
>>> with custom conversion code. x3 faster, and no, it's not written in assembly.
>> Interesting. I copy-pasted the code from source tree into a
>> test program, but it looks like there's no measurable difference in
>> performance of sprintf(dst, "%d-%d-%d",a,b,c) between glibc and linux
>> sprintf. Where did that 3x faster come from?
> It's not in 2.6.20, not even 2.6.22.
> You need some of the recent -rc. linux-2.6.23-rc9 definitely has it.
> See attached.

Thanks. I looked at the test case I ran earlier, and noticed that it was
in fact bogus; both test runs used the glibc version... I fixed that,
added a test case using the new linux code, and put up the results here:

The new linux code is slightly but not much faster than the old one
(3.04s vs 3.16s), but it does beat glibc (5.20s) by a wide margin.
However, preparsing the format string in gcc still beats the linux
version hands down (0.82s).

  Heikki Linnakangas

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]