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

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Wed Mar 20 14:27:25 GMT 2024



On 20/03/24 11:18, Cristian Rodríguez wrote:
> 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?

And this is the arc4random in userspace discussion all over again.


More information about the Libc-alpha mailing list