Re: Greatest Common Divisor

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Greatest Common Divisor
Дата
Msg-id 13445.1578095358@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Greatest Common Divisor  (Vik Fearing <vik.fearing@2ndquadrant.com>)
Ответы Re: Greatest Common Divisor
Re: Greatest Common Divisor
Список pgsql-hackers
Vik Fearing <vik.fearing@2ndquadrant.com> writes:
> On 03/01/2020 20:14, Fabien COELHO wrote:
>> The point of swapping is to a void possibly expensive modulo, but this
>> should be done on absolute values, otherwise it may not achieve its
>> purpose as stated by the comment?

> Ah, true. How widespread are these architectures that need this special
> treatment? Is it really worth handling?

On some older RISC architectures, integer division is really slow, like
slower than floating-point.  I'm not sure if that's true on any platform
people still care about though.  In recent years, CPU architects have been
able to throw all the transistors they needed at such problems.  On a
machine with single-cycle divide, it's likely that the extra
compare-and-branch is a net loss.

Might be worth checking it on ARM in particular, as being a RISC
architecture that's still popular.

Also, if we end up having a "numeric" implementation, it absolutely is
worth it for that, because there is nothing cheap about numeric_div.
I'd be sort of inclined to have the swap in the other implementations
just to keep the algorithms as much alike as possible.

            regards, tom lane



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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Greatest Common Divisor
Следующее
От: Mikael Kjellström
Дата:
Сообщение: Re: sidewinder has one failure