postgresql/src/backend
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
..
access Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
archive Fix memory leaks in error reporting with LOG level 2024-05-14 10:41:32 +02:00
backup Optimize escaping of JSON strings 2024-07-27 23:46:07 +12:00
bootstrap Include bison header files into implementation files 2024-08-02 10:25:11 +02:00
catalog Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
commands Small refactoring around ExecCreateTableAs(). 2024-08-02 12:52:56 -07:00
executor Evaluate arguments of correlated SubPlans in the referencing ExprState 2024-07-31 19:54:46 -07:00
foreign Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
jit Use CXXFLAGS instead of CFLAGS for linking C++ code 2024-08-04 11:17:46 +02:00
lib Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
libpq libpq: Use strerror_r instead of strerror 2024-07-28 09:23:24 +02:00
main Tighten check for --forkchild argument when spawning child process 2024-07-03 15:53:30 +03:00
nodes Convert node test compile-time settings into run-time parameters 2024-08-01 10:09:18 +02:00
optimizer Fix partitionwise join with partially-redundant join clauses 2024-07-30 15:51:54 +09:00
parser Convert node test compile-time settings into run-time parameters 2024-08-01 10:09:18 +02:00
partitioning Fix creation of partition descriptor during concurrent detach 2024-06-11 11:38:45 +02:00
po Translation updates 2024-06-24 13:11:27 +02:00
port Require memory barrier support. 2024-07-30 23:01:55 +12:00
postmaster Minor refactoring of assign_backendlist_entry() 2024-08-01 23:23:55 +03:00
regex Refactor pg_set_regex_collation() for clarity. 2024-07-28 16:55:17 -07:00
replication Include bison header files into implementation files 2024-08-02 10:25:11 +02:00
rewrite Correctly check updatability of columns targeted by INSERT...DEFAULT. 2024-07-20 13:40:15 -04:00
snowball Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
statistics Fix typos and duplicate words 2024-04-18 21:28:07 +02:00
storage Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
tcop Implement pg_wal_replay_wait() stored procedure 2024-08-02 21:16:56 +03:00
tsearch Remove unused #include's from backend .c files 2024-03-04 12:02:20 +01:00
utils Optimize JSON escaping using SIMD 2024-08-05 23:16:44 +12:00
.gitignore
common.mk Blind attempt to fix LLVM dependency in the backend 2022-09-15 10:53:48 +07:00
Makefile Fix make build on MinGW 2024-06-21 08:17:23 +02:00
meson.build meson: Fix import library name in Windows 2024-06-20 09:08:36 +02:00
nls.mk Add missing gettext triggers 2024-05-14 12:57:22 +02:00