Hand code string to integer conversion for performance.
Andres Freund <andres@anarazel.de>
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
Files
| Path | Change | +/− |
|---|---|---|
| contrib/spi/refint.c | modified | +1 −1 |
| doc/src/sgml/sources.sgml | modified | +1 −1 |
| src/backend/libpq/pqmq.c | modified | +3 −3 |
| src/backend/replication/libpqwalreceiver/libpqwalreceiver.c | modified | +2 −2 |
| src/backend/tsearch/wparser_def.c | modified | +4 −4 |
| src/backend/utils/adt/arrayutils.c | modified | +1 −2 |
| src/backend/utils/adt/int8.c | modified | +1 −0 |
| src/backend/utils/adt/int.c | modified | +2 −2 |
| src/backend/utils/adt/numutils.c | modified | +149 −0 |
| src/backend/utils/adt/varlena.c | modified | +2 −2 |
| src/include/utils/builtins.h | modified | +2 −0 |
| src/test/regress/expected/int2.out | modified | +7 −7 |
| src/test/regress/expected/select_parallel.out | modified | +1 −1 |
Documentation touched
Discussion
- Table with large number of int columns, very slow COPY FROM 9 messages · 2017-12-08 → 2018-07-20