diff options
author | John Naylor <john.naylor@postgresql.org> | 2021-12-17 12:27:21 -0400 |
---|---|---|
committer | John Naylor <john.naylor@postgresql.org> | 2022-02-04 10:53:24 -0500 |
commit | b31e3f561365136b48d63e8561f32b697df16d1d (patch) | |
tree | d5e82592ab2194dbac15ebf278cb1855c766f110 /src/backend/executor/nodeMergejoin.c | |
parent | 807fee1a39de6bb8184082012e643951abb9ad1d (diff) | |
download | postgresql-b31e3f561365136b48d63e8561f32b697df16d1d.tar.gz postgresql-b31e3f561365136b48d63e8561f32b697df16d1d.zip |
Improve worst-case performance of text_position_get_match_pos()
This function converts a byte position to a character position after
a successful string match. Rather than calling pg_mblen() in a loop,
use pg_mbstrlen_with_len() since the latter can inline its own call to
pg_mblen(). When the string match is at the end of the haystack text, this
change results in 10-20% performance improvement, depending on platform and
typical character length in bytes. This also simplifies the code a little.
Specializing for UTF-8 could result in further improvement, but the
performance gain was not found to be reliable between platforms. The modest
gain in this commit is stable between platforms and usable by all server
encodings.
Discussion:
https://www.postgresql.org/message-id/CAFBsxsH1Yutrmu+6LLHKK8iXY+vG--Do6zN+2900spHXQNNQKQ@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeMergejoin.c')
0 files changed, 0 insertions, 0 deletions