Re: Performance improvements for src/port/snprintf.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru>
Subject: Re: Performance improvements for src/port/snprintf.c
Date: 2018-10-06 03:59:15
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> Tom> Oh yeah? Where's the code for this?

> Upstream code is at
> ...
> I attach the patch I've used for testing, which has these changes from
> upstream Ryu:

Thanks. Just scanning through the code quickly, I note that it assumes
IEEE float format, which is probably okay but I suppose we might want
a configure switch to disable it (and revert to platform sprintf).
I couldn't immediately figure out if it's got endianness assumptions;
but even if it does, that'd likely only affect the initial disassembly
of the IEEE format, so probably not a huge deal.

I wonder which variant of the code you were testing (e.g. HAS_UINT128
or not).

There's a pretty large gap between this code and PG coding conventions,
both as to layout and portability rules. I wonder if we'd be better off
to implement the algorithm afresh instead of whacking this particular
code past the point of unrecognizability.

> The regression tests for
> float8 fail of course since Ryu's output format differs (it always
> includes an exponent, but the code for that part can be tweaked without
> touching the main algorithm).

Yeah, one would hope. But I wonder whether it always produces the
same low-order digits, and if not, whether people will complain.
We just had somebody griping about a change in insignificant zeroes
in timestamp output :-(. Still, seems worth further investigation.

regards, tom lane

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2018-10-06 04:32:58 Re: Performance improvements for src/port/snprintf.c
Previous Message Andrew Gierth 2018-10-06 03:36:51 Re: Performance improvements for src/port/snprintf.c