Speedup pg_strtok() with a static lookup table

This function has been known to be slow for a while and a redesign is
probably on the cards.  Meanwhile, let's try to squeeze a little more
performance out of it.

Here we define a 256-byte lookup table to specify character classes and
use that in the function rather than writing long and complex
expressions to get the same thing.

A benchmark showed pg_upgrade performing about 5% faster with this
change when restoring the database schemas into the new cluster, so more
of an evolution than a revolution.

Author: David Rowley <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Reviewed-by: David Steele <[email protected]>
Discussion: 
https://postgr.es/m/caaphdvo-yklqfhfjrcfjcbxmxni83xsfn6nbe79cwspchkt...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/56227fd51c452624b1c08947e4ed910a8d78748e

Modified Files
--------------
src/backend/nodes/read.c | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)

Reply via email to