Re: Preparsing sprintf format strings

2007-10-10 Thread Heikki Linnakangas
can easily just fall back to glibc sprintf in those cases. I was only thinking of implementing only the most commonly used formats anyway, initially at least. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com

Re: Preparsing sprintf format strings

2007-10-10 Thread Heikki Linnakangas
Kaveh R. GHAZI wrote: > On Mon, 8 Oct 2007, Heikki Linnakangas wrote: > >> sprintf(dest, "%d", arg1); -> a new function that does the same thing, >> but without the overhead of parsing the format string. Like itoa on some >> platforms. We could inline

Re: Preparsing sprintf format strings

2007-10-09 Thread Heikki Linnakangas
Denys Vlasenko wrote: > On Tuesday 09 October 2007 20:48, Heikki Linnakangas wrote: >> 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). > > You preparse "%d

Re: Preparsing sprintf format strings

2007-10-09 Thread Heikki Linnakangas
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 >>> as

Re: Preparsing sprintf format strings

2007-10-08 Thread Heikki Linnakangas
Denys Vlasenko wrote: > On Monday 08 October 2007 13:50, Heikki Linnakangas wrote: >> While profiling a test case of exporting data from PostgreSQL, I noticed >> that a lot of CPU time was spent in sprintf, formatting timestamps like >> "2007-10-01 12:34". I cou

Preparsing sprintf format strings

2007-10-08 Thread Heikki Linnakangas
been proposed before? I couldn't find anything relevant in the archives. One small problem I see is that if you replace one of the output handlers for something like %s with register_printf_function, the simplified code won't honor that replacement. Actually, we have that prob