diff options
author | Robert Haas | 2010-12-22 03:11:40 +0000 |
---|---|---|
committer | Robert Haas | 2010-12-22 03:11:40 +0000 |
commit | 32ba2b516066688ff56e6d62a7ff4a01c88f5700 (patch) | |
tree | d92587bec7ec83167b11d71afd204fa72d1f6f80 /contrib/ltree/ltree_gist.c | |
parent | c5160b7eecf97a357375960b02a30317474334a3 (diff) |
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.
Diffstat (limited to 'contrib/ltree/ltree_gist.c')
-rw-r--r-- | contrib/ltree/ltree_gist.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/ltree/ltree_gist.c b/contrib/ltree/ltree_gist.c index 5fa7b59d32d..47a85bbabc2 100644 --- a/contrib/ltree/ltree_gist.c +++ b/contrib/ltree/ltree_gist.c @@ -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; |