pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Hand code string to integer conversion for performance.
Date: Sun, 22 Jul 2018 22:30:20 +0000
Message-ID: <E1fhMrs-00034X-Uw@gemulon.postgresql.org> (raw)

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(-)



view thread (4+ messages)  latest in thread

Message-ID: <E1fhMrs-00034X-Uw@gemulon.postgresql.org>
Permalink:  ../E1fhMrs-00034X-Uw@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fhMrs-00034X-Uw@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: andres@anarazel.de
  Subject: Re: pgsql: Hand code string to integer conversion for performance.
  In-Reply-To: <E1fhMrs-00034X-Uw@gemulon.postgresql.org>
  References: <E1fhMrs-00034X-Uw@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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