pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Yura Sokolov <y.sokolov@postgrespro.ru>
To: Fabien COELHO <coelho@cri.ensmp.fr>
Cc: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Aleksander Alekseev <aleksander@timescale.com>
Cc: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Subject: Re: rand48 replacement
Date: Sat, 03 Jul 2021 13:20:52 +0300
Message-ID: <25e12be71909b5716ab4dd2d64d65da0@postgrespro.ru> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2107031044270.2359988@pseudo>
References: <alpine.DEB.2.22.394.2105241211230.165418@pseudo>
	<43a6e30b-542f-671a-e7bb-b7f78cf90e8c@enterprisedb.com>
	<alpine.DEB.2.22.394.2105241310350.165418@pseudo>
	<CAJ7c6TM2qJdtehyLA79gFtZ+h7jwRrksK4ZAW7boxgQJqQkRAw@mail.gmail.com>
	<alpine.DEB.2.22.394.2105241509200.165418@pseudo>
	<699567.1625156441@sss.pgh.pa.us>
	<alpine.DEB.2.22.394.2107011842240.2143494@pseudo>
	<746421.1625164869@sss.pgh.pa.us>
	<CAEZATCXvzDSNhH2uRMUt5K_vmMBDrvo+D7Sn66--1Z_ELz==5Q@mail.gmail.com>
	<alpine.DEB.2.22.394.2107012212500.2248546@pseudo>
	<CAEZATCVpnOjrwU=4712OPjNDqV2sVkkK7XHDiR-nzYDL8N6z=Q@mail.gmail.com>
	<alpine.DEB.2.22.394.2107022340250.2359988@pseudo>
	<alpine.DEB.2.22.394.2107030902400.2359988@pseudo>
	<alpine.DEB.2.22.394.2107031044270.2359988@pseudo>

Fabien COELHO wrote 2021-07-03 11:45:
> And a v5 where an unused test file does also compile if we insist.

About patch:
1. PostgreSQL source uses `uint64` and `uint32`, but not 
`uint64_t`/`uint32_t`
2. I don't see why pg_prng_state could not be `typedef uint64 
pg_prng_state[2];`
3. Then SamplerRandomState and pgbench RandomState could stay.
    Patch will be a lot shorter.
    I don't like mix of semantic refactoring and syntactic refactoring in 
the
    same patch.
    While I could agree with replacing `SamplerRandomState => 
pg_prng_state`, I'd
    rather see it in separate commit.
    And that separate commit could contain transition:
    `typedef uint64 pg_prng_state[2];` => `typedef struct { uint64 s0, s1 
} pg_prng_state;`
4. There is no need in ReservoirStateData->randstate_initialized. There 
could
    be macros/function:
    `bool pg_prng_initiated(state) { return (state[0]|state[1]) != 0; }`
5. Is there need for 128bit prng at all? At least 2*64bit.
    There are 2*32bit xoroshiro64 
https://prng.di.unimi.it/xoroshiro64starstar.c
    And there is 4*32bit xoshiro128: 
https://prng.di.unimi.it/xoshiro128plusplus.c
    32bit operations are faster on 32bit platforms.
    But 32bit platforms are quite rare in production this days.
    Therefore I don't have strong opinion on this.

regards,
Sokolov Yura.





view thread (59+ messages)  latest in thread

Message-ID: <25e12be71909b5716ab4dd2d64d65da0@postgrespro.ru>
Permalink:  ../25e12be71909b5716ab4dd2d64d65da0@postgrespro.ru/
Also on:    postgresql.org/message-id/25e12be71909b5716ab4dd2d64d65da0@postgrespro.ru

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: y.sokolov@postgrespro.ru, coelho@cri.ensmp.fr, dean.a.rasheed@gmail.com, tgl@sss.pgh.pa.us, aleksander@timescale.com
  Subject: Re: rand48 replacement
  In-Reply-To: <25e12be71909b5716ab4dd2d64d65da0@postgrespro.ru>
  References: <alpine.DEB.2.22.394.2105241211230.165418@pseudo> <43a6e30b-542f-671a-e7bb-b7f78cf90e8c@enterprisedb.com> <alpine.DEB.2.22.394.2105241310350.165418@pseudo> <CAJ7c6TM2qJdtehyLA79gFtZ+h7jwRrksK4ZAW7boxgQJqQkRAw@mail.gmail.com> <alpine.DEB.2.22.394.2105241509200.165418@pseudo> <699567.1625156441@sss.pgh.pa.us> <alpine.DEB.2.22.394.2107011842240.2143494@pseudo> <746421.1625164869@sss.pgh.pa.us> <CAEZATCXvzDSNhH2uRMUt5K_vmMBDrvo+D7Sn66--1Z_ELz==5Q@mail.gmail.com> <alpine.DEB.2.22.394.2107012212500.2248546@pseudo> <CAEZATCVpnOjrwU=4712OPjNDqV2sVkkK7XHDiR-nzYDL8N6z=Q@mail.gmail.com> <alpine.DEB.2.22.394.2107022340250.2359988@pseudo> <alpine.DEB.2.22.394.2107030902400.2359988@pseudo> <alpine.DEB.2.22.394.2107031044270.2359988@pseudo> <25e12be71909b5716ab4dd2d64d65da0@postgrespro.ru>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox