Re: Faster str to int conversion (was Table with large number of int columns, very slow COPY FROM)

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Alex Tokarev <dwalin(at)dwalin(dot)ru>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Faster str to int conversion (was Table with large number of int columns, very slow COPY FROM)
Date: 2018-07-20 12:27:34
Message-ID: CA+TgmoY+e-yid5CZDh3HmSm9FEXWXsX_s5ANqYFrjgRmyV4QAA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Thu, Jul 19, 2018 at 4:32 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
>> 1. Why the error message changes? If there's a good reason, it should
>> be done as a separate commit, or at least well-documented in the
>> commit message.
>
> Because there's a lot of "invalid input syntax for type %s: \"%s\"",
> error messages, and we shouldn't force translators to have separate
> version that inlines the first %s. But you're right, it'd be worthwhile
> to point that out in the commit message.

It just seems weird that they're bundled together in one commit like this.

>> 2. Does the likely/unlikely stuff make a noticeable difference?
>
> Yes. It's also largely a copy from existing code (scanint8), so I don't
> really want to differ here.

OK.

>> 3. If this is a drop-in replacement for pg_atoi, why not just recode
>> pg_atoi this way -- or have it call this -- and leave the callers
>> unchanged?
>
> Because pg_atoi supports a variable 'terminator'.

OK.

>> 4. Are we sure this is faster on all platforms, or could it work out
>> the other way on, say, BSD?
>
> I'd be *VERY* surprised if any would be faster. It's not easy to write a
> faster implmentation, than what I've proposed, and especially not so if
> you use strtol() as the API (variable bases, a bit of locale support).

OK.

Nothing else from me...

--
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 2018-07-20 12:38:09 Re: Expression errors with "FOR UPDATE" and postgres_fdw with partition wise join enabled.
Previous Message Jesper Pedersen 2018-07-20 12:26:03 Re: partition tree inspection functions

Browse pgsql-performance by date

  From Date Subject
Next Message Andres Freund 2018-07-20 16:45:10 Re: Faster str to int conversion (was Table with large number of int columns, very slow COPY FROM)
Previous Message Mark Kirkwood 2018-07-20 01:49:45 Re: Why HDD performance is better than SSD in this case