[PATCH 2/2] Add single-threaded fast path to rand()

Cristian Rodríguez cristian@rodriguez.im
Wed Mar 20 14:18:09 GMT 2024


On Wed, Mar 20, 2024 at 9:31 AM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:


> I don't have a strong opinion on this rand patch, if this idea is to
> have it as an workbench for a possible single-thread lock optimization
> it should be fine.  It is just that I don't see much gain in optimizing
> such a bad interface (although we still lack a proper userland PRNG).

Yeah, it should be no surprise this interfaces are bad,
I thought this was common knowledge.

we need something like https://github.com/C2SP/C2SP/blob/main/chacha8rand.md
which prety much outperforms even non-CS algorithms in at least 64 bit x86.
but the question of the state remains.global? TLS? how to discard it
in all the appropriate occasions?


More information about the Libc-alpha mailing list