Re: B-Tree support function number 3 (strxfrm() optimization)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)heroku(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: B-Tree support function number 3 (strxfrm() optimization)
Date: 2014-09-19 16:59:39
Message-ID: CA+TgmoZwQArU2hnjHb-RVot_k6udo6=JwDKWsjJiTHGnJ7WQEg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 16, 2014 at 4:55 PM, Peter Geoghegan <pg(at)heroku(dot)com> wrote:
> On Tue, Sep 16, 2014 at 1:45 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> Even though our testing seems to indicate that the memcmp() is
>> basically free, I think it would be good to make the effort to avoid
>> doing memcmp() and then strcoll() and then strncmp(). Seems like it
>> shouldn't be too hard.
>
> Really? The tie-breaker for the benefit of locales like hu_HU uses
> strcmp(), not memcmp(). It operates on the now-terminated copies of
> strings. There is no reason to think that the strings must be the same
> size for that strcmp(). I'd rather only do the new opportunistic
> "memcmp() == 0" thing when len1 == len2. And I wouldn't like to have
> to also figure out that it's safe to use the earlier result, because
> as it happens len1 == len2, or any other such trickery.

OK, good point. So committed as-is, then, except that I rewrote the
comments, which I felt were excessively long for the amount of code.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-09-19 17:13:16 Re: Minor improvement in lock.sgml
Previous Message Stephen Frost 2014-09-19 16:54:12 Re: RLS Design