mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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
This commit is contained in:
@ -306,7 +306,7 @@ check_foreign_key(PG_FUNCTION_ARGS)
|
||||
/* internal error */
|
||||
elog(ERROR, "check_foreign_key: too short %d (< 5) list of arguments", nargs);
|
||||
|
||||
nrefs = pg_atoi(args[0], sizeof(int), 0);
|
||||
nrefs = pg_strtoint32(args[0]);
|
||||
if (nrefs < 1)
|
||||
/* internal error */
|
||||
elog(ERROR, "check_foreign_key: %d (< 1) number of references specified", nrefs);
|
||||
|
Reference in New Issue
Block a user