Re: random() (was Re: New GUC to sample log queries)

Поиск
Список
Период
Сортировка
От Fabien COELHO
Тема Re: random() (was Re: New GUC to sample log queries)
Дата
Msg-id alpine.DEB.2.21.1812281149090.32444@lancre
обсуждение исходный текст
Ответ на Re: random() (was Re: New GUC to sample log queries)  (Fabien COELHO <coelho@cri.ensmp.fr>)
Ответы Re: random() (was Re: New GUC to sample log queries)  (Fabien COELHO <coelho@cri.ensmp.fr>)
Список pgsql-hackers
>> - lrand48 (48 bits state as 3 uint16)        is 29 ops
>>   (10 =, 8 *, 7 +, 4 >>)
>
> - xoshiro256** (256 bits states as 4 uint64) is 24 ops (18 if rot in hw)
>   8 =, 2 *, 2 +, 5 <<, 5 ^, 2 |
>
> See http://vigna.di.unimi.it/xorshift/

Small benchmark on my laptop with gcc-7.3 -O3:

  - pg_lrand48 takes 4.0 seconds to generate 1 billion 32-bit ints

  - xoshiro256** takes 1.6 seconds to generate 1 billion 64-bit ints

With -O2 it is 4.8 and 3.4 seconds, respectively. So significantly better 
speed _and_ quality are quite achievable.

Note that small attempt at optimizing these functions (inline constants, 
array replaced with scalars) did not yield significant improvements.

-- 
Fabien.
Вложения

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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Offline enabling/disabling of data checksums
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: could recovery_target_timeline=latest be the default in standbymode?