postgresql/src
David Rowley ca6fde9225 Optimize JSON escaping using SIMD
Here we adjust escape_json_with_len() to make use of SIMD to allow
processing of up to 16-bytes at a time rather than processing a single
byte at a time.  This has been shown to speed up escaping of JSON
strings significantly.

Escaping is required for both JSON string properties and also the
property names themselves, so this should also help improve the speed of
the conversion from JSON into text for JSON objects that have property
names 16 or more bytes long.

Escaping JSON strings was often a significant bottleneck for longer
strings.  With these changes, some benchmarking has shown a query
performing nearly 4 times faster when escaping a JSON object with a 1MB
text property.  Tests with shorter text properties saw smaller but still
significant performance improvements.  For example, a test outputting 1024
JSON strings with a text property length ranging from 1 char to 1024 chars
became around 2 times faster.

Author: David Rowley
Reviewed-by: Melih Mutlu
Discussion: https://postgr.es/m/CAApHDvpLXwMZvbCKcdGfU9XQjGCDm7tFpRdTXuB9PVgpNUYfEQ@mail.gmail.com
2024-08-05 23:16:44 +12:00
..
backend Optimize JSON escaping using SIMD 2024-08-05 23:16:44 +12:00
bin Fix NLS file reference in pg_createsubscriber 2024-08-02 12:05:38 -04:00
common Convert some extern variables to static, Windows code 2024-08-01 13:28:32 +02:00
fe_utils Fix PL/pgSQL's handling of integer ranges containing underscores. 2024-06-04 11:48:01 +01:00
include Fix typo in bufpage.h. 2024-08-05 14:38:00 +05:30
interfaces Add -Wmissing-variable-declarations to the standard compilation flags 2024-08-03 11:51:02 +02:00
makefiles Add -Wmissing-variable-declarations to the standard compilation flags 2024-08-03 11:51:02 +02:00
pl Include bison header files into implementation files 2024-08-02 10:25:11 +02:00
port Add port/ replacement for strsep() 2024-07-22 09:50:30 +02:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Optimize JSON escaping using SIMD 2024-08-05 23:16:44 +12:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools injection_points: Add some fixed-numbered statistics 2024-08-05 12:29:22 +09:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Add -Wmissing-variable-declarations to the standard compilation flags 2024-08-03 11:51:02 +02:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00