Re: CopyReadLineText optimization - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Re: CopyReadLineText optimization
Date
Msg-id 47D04F23.8060908@enterprisedb.com
Whole thread Raw
In response to Re: CopyReadLineText optimization  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-patches
Andrew Dunstan wrote:
> Heikki Linnakangas wrote:
>> Andrew Dunstan wrote:
>>> I'm still a bit worried about applying it unless it gets some
>>> adaptive behaviour or something so that we don't cause any serious
>>> performance regressions in some cases.
>>
>> I'll try to come up with something. At the most conservative end, we
>> could fall back to the current method on the first escape, quote or
>> backslash character.
>
> That's far too conservative, I think. Somewhere a bit short of your
> observed breakeven point seems about right.

The problem is, you don't know how many "stop" characters there is until
you've counted them.

We could fall back after X such characters, or only start using memchr
after seeing 8 consecutive non-stop characters. Whatever we choose, the
heuristic needs to be very simple and fast to check, otherwise we just
introduce more overhead trying to decide which method to use.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: CopyReadLineText optimization
Next
From: Greg Smith
Date:
Subject: Re: CopyReadLineText optimization