mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Use memcmp() rather than strncmp() when shorter string length is known.
It appears that this will be faster for all but the shortest strings; at least one some platforms, memcmp() can use word-at-a-time comparisons. Noah Misch, somewhat pared down.
This commit is contained in:
@ -546,7 +546,7 @@ gist_tqcmp(ltree *t, lquery *q)
|
||||
while (an > 0 && bn > 0)
|
||||
{
|
||||
bl = LQL_FIRST(ql);
|
||||
if ((res = strncmp(al->name, bl->name, Min(al->len, bl->len))) == 0)
|
||||
if ((res = memcmp(al->name, bl->name, Min(al->len, bl->len))) == 0)
|
||||
{
|
||||
if (al->len != bl->len)
|
||||
return al->len - bl->len;
|
||||
|
Reference in New Issue
Block a user