pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Hand code string to integer conversion for performance.
4+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2018-07-24 b2bb3dc0e0 Defend against some potential spurious compiler warnings in 86eaf208e.
* pgsql: Hand code string to integer conversion for performance.
@ 2018-07-22 22:30 Andres Freund <andres@anarazel.de>
2018-07-24 10:10 ` Re: pgsql: Hand code string to integer conversion for performance. David Rowley <david.rowley@2ndquadrant.com>
0 siblings, 1 reply; 4+ messages in thread
From: Andres Freund @ 2018-07-22 22:30 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Hand code string to integer conversion for performance.
As benchmarks show, using libc's string-to-integer conversion is
pretty slow. At least part of the reason for that is that strtol[l]
have to be more generic than what largely is required inside pg.
This patch considerably speeds up int2/int4 input (int8 already was
already using hand-rolled code).
Most of the existing pg_atoi callers have been converted. But as one
requires pg_atoi's custom delimiter functionality, and as it seems
likely that there's external pg_atoi users, it seems sensible to just
keep pg_atoi around.
Author: Andres Freund
Reviewed-By: Robert Haas
Discussion: https://postgr.es/m/20171208214437.qgn6zdltyq5hmjpk@alap3.anarazel.de
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/86eaf208ea048936df6be77276a246d3f92e9620
Modified Files
--------------
contrib/spi/refint.c | 2 +-
doc/src/sgml/sources.sgml | 2 +-
src/backend/libpq/pqmq.c | 6 +-
.../libpqwalreceiver/libpqwalreceiver.c | 4 +-
src/backend/tsearch/wparser_def.c | 8 +-
src/backend/utils/adt/arrayutils.c | 3 +-
src/backend/utils/adt/int.c | 4 +-
src/backend/utils/adt/int8.c | 1 +
src/backend/utils/adt/numutils.c | 149 +++++++++++++++++++++
src/backend/utils/adt/varlena.c | 4 +-
src/include/utils/builtins.h | 2 +
src/test/regress/expected/int2.out | 14 +-
src/test/regress/expected/select_parallel.out | 2 +-
13 files changed, 176 insertions(+), 25 deletions(-)
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Hand code string to integer conversion for performance.
2018-07-22 22:30 pgsql: Hand code string to integer conversion for performance. Andres Freund <andres@anarazel.de>
@ 2018-07-24 10:10 ` David Rowley <david.rowley@2ndquadrant.com>
2018-07-24 17:11 ` Re: pgsql: Hand code string to integer conversion for performance. Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 4+ messages in thread
From: David Rowley @ 2018-07-24 10:10 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org
On 23 July 2018 at 10:30, Andres Freund <andres@anarazel.de> wrote:
> Hand code string to integer conversion for performance.
This could do with the attached to silence the compiler warnings from
compilers that don't understand ereport(ERROR) does not return.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachments:
silence_compiler_warnings_in_pg_strtoint_funcs.patch (application/octet-stream, 630B) download
diff --git a/src/backend/utils/adt/numutils.c b/src/backend/utils/adt/numutils.c
index 49055d519c..0fa167d334 100644
--- a/src/backend/utils/adt/numutils.c
+++ b/src/backend/utils/adt/numutils.c
@@ -181,6 +181,8 @@ invalid_syntax:
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for type %s: \"%s\"",
"smallint", s)));
+
+ return 0; /* keep compiler quiet */
}
/*
@@ -255,6 +257,8 @@ invalid_syntax:
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
errmsg("invalid input syntax for type %s: \"%s\"",
"integer", s)));
+
+ return 0; /* keep compiler quiet */
}
/*
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Hand code string to integer conversion for performance.
2018-07-22 22:30 pgsql: Hand code string to integer conversion for performance. Andres Freund <andres@anarazel.de>
2018-07-24 10:10 ` Re: pgsql: Hand code string to integer conversion for performance. David Rowley <david.rowley@2ndquadrant.com>
@ 2018-07-24 17:11 ` Andres Freund <andres@anarazel.de>
2018-07-24 22:30 ` Re: pgsql: Hand code string to integer conversion for performance. David Rowley <david.rowley@2ndquadrant.com>
0 siblings, 1 reply; 4+ messages in thread
From: Andres Freund @ 2018-07-24 17:11 UTC (permalink / raw)
To: David Rowley <david.rowley@2ndquadrant.com>; +Cc: pgsql-committers@lists.postgresql.org
On 2018-07-24 22:10:09 +1200, David Rowley wrote:
> On 23 July 2018 at 10:30, Andres Freund <andres@anarazel.de> wrote:
> > Hand code string to integer conversion for performance.
>
> This could do with the attached to silence the compiler warnings from
> compilers that don't understand ereport(ERROR) does not return.
Pushed. Not sure if any of those do enough control flow analysis to
even consider those blocks reachable? But anyway, doesn't hurt.
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: pgsql: Hand code string to integer conversion for performance.
2018-07-22 22:30 pgsql: Hand code string to integer conversion for performance. Andres Freund <andres@anarazel.de>
2018-07-24 10:10 ` Re: pgsql: Hand code string to integer conversion for performance. David Rowley <david.rowley@2ndquadrant.com>
2018-07-24 17:11 ` Re: pgsql: Hand code string to integer conversion for performance. Andres Freund <andres@anarazel.de>
@ 2018-07-24 22:30 ` David Rowley <david.rowley@2ndquadrant.com>
0 siblings, 0 replies; 4+ messages in thread
From: David Rowley @ 2018-07-24 22:30 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: pgsql-committers@lists.postgresql.org
On 25 July 2018 at 05:11, Andres Freund <andres@anarazel.de> wrote:
> Pushed. Not sure if any of those do enough control flow analysis to
> even consider those blocks reachable? But anyway, doesn't hurt.
Thanks. MSVC was producing a warning.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2018-07-24 22:30 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-22 22:30 pgsql: Hand code string to integer conversion for performance. Andres Freund <andres@anarazel.de>
2018-07-24 10:10 ` David Rowley <david.rowley@2ndquadrant.com>
2018-07-24 17:11 ` Andres Freund <andres@anarazel.de>
2018-07-24 22:30 ` David Rowley <david.rowley@2ndquadrant.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox