Re: Efficient output for integer types

Поиск
Список
Период
Сортировка
От David Fetter
Тема Re: Efficient output for integer types
Дата
Msg-id 20190915161203.GL31596@fetter.org
обсуждение исходный текст
Ответ на Re: Efficient output for integer types  (Andrey Borodin <x4mmm@yandex-team.ru>)
Список pgsql-hackers
On Sun, Sep 15, 2019 at 02:06:29PM +0500, Andrey Borodin wrote:
> > 15 сент. 2019 г., в 12:18, David Fetter <david@fetter.org> написал(а):
> > 
> > Please find attached a couple of patches intended to $subject.
> > 
> > This patch set cut the time to copy ten million rows of randomly sized
> > int8s (10 of them) by about a third, so at least for that case, it's
> > pretty decent.
> 
> Hi! Looks cool.
> 
> Just curious if for any fixed base and square here
> 
> +        while(uvalue >= base)
>          {
> +            const int i = (uvalue % square) * 2;
> +            uvalue /= square;
> +            vallen += 2;
> +            memcpy(convert + sizeof(convert) - vallen, digits + i, 2);
> +        }
> 
> compiler will have a chance to avoid idiv instruction?

That could very well be.  I took the idea (and most of the code) from
the Ryū implementation Andrew Gierth committed for 12.

> Maybe few specialized functions could work better than generic
> algorithm?

Could be.  What do you have in mind?  I'm guessing that the ones for
decimals, that being both the most common case and the least obvious
as to how to optimize, would give the most benefit.

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tomas Vondra
Дата:
Сообщение: Re: Primary keepalive message not appearing in Logical StreamingReplication
Следующее
От: Jeff Janes
Дата:
Сообщение: Re: log spam with postgres_fdw