pgsql: Use new overflow aware integer operations.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Use new overflow aware integer operations.
Date: 2017-12-13 01:01:19
Message-ID: E1eOvQF-00075s-D1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use new overflow aware integer operations.

A previous commit added inline functions that provide fast(er) and
correct overflow checks for signed integer math. Use them in a
significant portion of backend code. There's more to touch in both
backend and frontend code, but these were the easily identifiable
cases.

The old overflow checks are noticeable in integer heavy workloads.

A secondary benefit is that getting rid of overflow checks that rely
on signed integer overflow wrapping around, will allow us to get rid
of -fwrapv in the future. Which in turn slows down other code.

Author: Andres Freund
Discussion: https://postgr.es/m/20171024103954.ztmatprlglz3rwke@alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/101c7ee3ee847bac970c74b73b4f2858484383e5

Modified Files
--------------
contrib/btree_gist/btree_cash.c | 10 +-
contrib/btree_gist/btree_int2.c | 10 +-
contrib/btree_gist/btree_int4.c | 10 +-
contrib/btree_gist/btree_int8.c | 10 +-
contrib/btree_gist/btree_utils_num.h | 2 -
src/backend/utils/adt/array_userfuncs.c | 13 +-
src/backend/utils/adt/cash.c | 39 ++--
src/backend/utils/adt/float.c | 9 +-
src/backend/utils/adt/int.c | 200 ++++-------------
src/backend/utils/adt/int8.c | 377 ++++++++------------------------
src/backend/utils/adt/numeric.c | 41 ++--
src/backend/utils/adt/oracle_compat.c | 18 +-
src/backend/utils/adt/varbit.c | 4 +-
src/backend/utils/adt/varlena.c | 13 +-
14 files changed, 217 insertions(+), 539 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2017-12-13 01:23:07 pgsql: Make PGAC_C_BUILTIN_OP_OVERFLOW link instead of just compiling.
Previous Message Robert Haas 2017-12-13 00:37:27 pgsql: Remove obsolete comment.