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

From: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, 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:10:00
Message-ID: 87sh1jaiyq.fsf@news-spur.riddles.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>>>>> "Andres" == Andres Freund <andres(at)anarazel(dot)de> writes:

Andres> I'm not convinced. Because of some hypothetical platform that
Andres> may introduce strfromd() in a broken/slower manner, but where
Andres> sprintf() is correct, we should not do the minimal work to
Andres> alleviate an actual performance bottleneck in a trivial manner
Andres> on linux? Our most widely used platform? If we find a platform
Andres> where it's borked, we could just add a small hack into their
Andres> platform template file.

So here's a thing: I finally got to doing my performance tests for using
the Ryu float output code in float[48]out.

Ryu is so blazing fast that with it, COPY of a table with 2million rows
of 12 random float8 columns (plus id) becomes FASTER in text mode than
in binary mode (rather than ~5x slower):

copy binary flttst to '/dev/null'; -- binary
Time: 3222.444 ms (00:03.222)

copy flttst to '/dev/null'; -- non-Ryu
Time: 16416.161 ms (00:16.416)

copy flttst to '/dev/null'; -- Ryu
Time: 2691.642 ms (00:02.692)

(And yes, I've double-checked the results and they look correct, other
than the formatting differences. COPY BINARY seems to have a bit more
overhead than text mode, even for just doing integers, I don't know
why.)

--
Andrew (irc:RhodiumToad)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-10-06 03:16:13 Re: Performance improvements for src/port/snprintf.c
Previous Message Tom Lane 2018-10-06 02:58:37 Re: Performance improvements for src/port/snprintf.c