From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: Performance improvements for src/port/snprintf.c |
Date: | 2018-08-19 22:07:45 |
Message-ID: | 2238.1534716465@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I wrote:
> [ snprintf-speedups-1.patch ]
Here's a slightly improved version of that, with two changes:
* Given the current state of the what-about-%m thread, it's no longer
academic how well this performs relative to glibc's version. I poked
at that and found that a lot of the discrepancy came from glibc using
strchrnul() to find the next format specifier --- apparently, that
function is a *lot* faster than the equivalent manual loop. So this
version uses that if available.
* I thought of a couple of easy wins for fmtfloat. We can pass the
precision spec down to the platform's sprintf using "*" notation instead
of converting it to text and back, and that also simplifies matters enough
that we can avoid using an sprintf call to build the simplified format
string. This seems to get us down to the vicinity of a 10% speed penalty
on microbenchmarks of just float conversion, which is enough to satisfy
me given the other advantages of switching to our own snprintf.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
snprintf-speedups-2.patch | text/x-diff | 28.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2018-08-19 22:47:17 | Re: [sqlsmith] ERROR: partition missing from subplans |
Previous Message | Tom Lane | 2018-08-19 19:12:00 | Re: Allowing printf("%m") only where it actually works |