From: | John Naylor <john(dot)naylor(at)postgresql(dot)org> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Speed up tail processing when hashing aligned C strings |
Date: | 2024-03-31 05:32:46 |
Message-ID: | E1rqnoE-006d4W-4D@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Speed up tail processing when hashing aligned C strings
After encountering the NUL terminator, the word-at-a-time loop exits
and we must hash the remaining bytes. Previously we calculated the
terminator's position and re-loaded the remaining bytes from the input
string. We already have all the data we need in a register, so let's
just mask off the bytes we need and hash them immediately. The mask can
be cheaply computed without knowing the terminator's position. We still
need that position for the length calculation, but the CPU can now
do that in parallel with other work, shortening the dependency chain.
Ants Aasma and John Naylor
Discussion: https://postgr.es/m/CANwKhkP7pCiW_5fAswLhs71-JKGEz1c1%2BPC0a_w1fwY4iGMqUA%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/07f0f6abfc7f6c55cede528d9689dedecefc734a
Modified Files
--------------
src/include/common/hashfn_unstable.h | 44 ++++++++++++++++++++++++++++--------
1 file changed, 34 insertions(+), 10 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | John Naylor | 2024-03-31 06:05:05 | Re: pgsql: Speed up tail processing when hashing aligned C strings |
Previous Message | Alexander Korotkov | 2024-03-30 20:54:54 | pgsql: Custom reloptions for table AM |