pgsql: Optimize hex_encode() and hex_decode() using SIMD. - Mailing list pgsql-committers

From Nathan Bossart
Subject pgsql: Optimize hex_encode() and hex_decode() using SIMD.
Date
Msg-id E1v5p25-000NOz-25@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Optimize hex_encode() and hex_decode() using SIMD.

The hex_encode() and hex_decode() functions serve as the workhorses
for hexadecimal data for bytea's text format conversion functions,
and some workloads are sensitive to their performance.  This commit
adds new implementations that use routines from port/simd.h, which
testing indicates are much faster for larger inputs.  For small or
invalid inputs, we fall back on the existing scalar versions.
Since we are using port/simd.h, these optimizations apply to both
x86-64 and AArch64.

Author: Nathan Bossart <nathandbossart@gmail.com>
Co-authored-by: Chiranmoy Bhattacharya <chiranmoy.bhattacharya@fujitsu.com>
Co-authored-by: Susmitha Devanga <devanga.susmitha@fujitsu.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aLhVWTRy0QPbW2tl%40nathan

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/ec8719ccbfcd78c6b40b5f2b94f60769f3bd08aa

Modified Files
--------------
src/backend/utils/adt/encode.c        | 137 +++++++++++++++++++++-
src/include/port/simd.h               | 211 ++++++++++++++++++++++++++++++++++
src/test/regress/expected/strings.out |  58 ++++++++++
src/test/regress/sql/strings.sql      |  16 +++
4 files changed, 418 insertions(+), 4 deletions(-)


pgsql-committers by date:

Previous
From: Andrew Dunstan
Date:
Subject: pgsql: Revert "Improve docs syntax checking"
Next
From: Masahiko Sawada
Date:
Subject: pgsql: Avoid unnecessary GinFormTuple() calls for incompressible postin