On Mon, Dec 20, 2010 at 1:10 PM, Noah Misch <n...@leadboat.com> wrote: > When the caller knows the smaller string length, memcmp and strncmp are > functionally equivalent. Since memcmp need not watch each byte for a NULL > terminator, it often compares a CPU word at a time for better performance. > The > attached patch changes use of strncmp to memcmp where we have the length of > the > shorter string. I was most interested in the varlena.c instances, but I tried > to find all applicable call sites. To benchmark it, I used the attached > "bench-texteq.sql". This patch improved my 5-run average timing of the SELECT > from 65.8s to 56.9s, a 13% improvement. I can't think of a case where the > change should be pessimal.
This is a good idea. I will check this over and commit it. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers