From: Xi Ruoyao <xry111@xry111.site>
To: "Wilco Dijkstra" <Wilco.Dijkstra@arm.com>,
"Cristian Rodríguez" <cristian@rodriguez.im>,
"Adhemerval Zanella Netto" <adhemerval.zanella@linaro.org>
Cc: GNU C Library <libc-alpha@sourceware.org>
Subject: Re: [PATCH 2/2] Add single-threaded fast path to rand()
Date: Wed, 20 Mar 2024 22:40:09 +0800 [thread overview]
Message-ID: <228b899bb5d90d1dd9a87ebc35924df309054447.camel@xry111.site> (raw)
In-Reply-To: <PAWPR08MB8982A94E3509AA7515A087C083332@PAWPR08MB8982.eurprd08.prod.outlook.com>
On Wed, 2024-03-20 at 14:28 +0000, Wilco Dijkstra wrote:
> Hi Cristian,
>
> > Yeah, it should be no surprise this interfaces are bad,
> > I thought this was common knowledge.
>
> It's bad but we also made it thread-safe via locks rather than add its state to TLS.
>
> > 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?
>
> I believe the current implementation is already way overkill. All you need is a simple
> LFSR random generator with 64 bits of state and a decently large cycle. It's not
> meant to be a serious random number generator - it's invariably used to generate
> randomized inputs for testing and benchmarking. That's all. The complaints are
> due to it being too slow due to all the locking.
Yes, we don't need a *CS*PRNG, just a PRNG. Thus no "oops, the user
space cannot know whether to reseed" stuff.
--
Xi Ruoyao <xry111@xry111.site>
School of Aerospace Science and Technology, Xidian University
next prev parent reply other threads:[~2024-03-20 14:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-18 15:20 [PATCH 2/2] Add single-threaded fast path to rand() Wilco Dijkstra
2024-03-18 19:24 ` Cristian Rodríguez
2024-03-19 15:44 ` Wilco Dijkstra
2024-03-20 12:31 ` Adhemerval Zanella Netto
2024-03-20 14:18 ` Cristian Rodríguez
2024-03-20 14:27 ` Adhemerval Zanella Netto
2024-03-21 7:39 ` Florian Weimer
2024-03-21 13:33 ` Cristian Rodríguez
2024-03-21 14:35 ` Mathieu Desnoyers
2024-03-21 15:07 ` Szabolcs Nagy
2024-03-21 15:18 ` Wilco Dijkstra
2024-03-21 15:53 ` Adhemerval Zanella Netto
2024-03-22 14:27 ` Zack Weinberg
2024-03-22 14:46 ` Adhemerval Zanella Netto
2024-03-22 15:30 ` Zack Weinberg
2024-03-22 18:05 ` Adhemerval Zanella Netto
2024-03-22 19:47 ` Mathieu Desnoyers
2024-03-22 22:54 ` Cristian Rodríguez
2024-03-23 14:01 ` Zack Weinberg
2024-03-23 15:23 ` Mathieu Desnoyers
2024-03-25 14:09 ` Mathieu Desnoyers
2024-03-25 17:52 ` Adhemerval Zanella Netto
2024-03-24 0:59 ` Cristian Rodríguez
2024-03-25 6:44 ` Florian Weimer
2024-03-20 14:28 ` Wilco Dijkstra
2024-03-20 14:40 ` Xi Ruoyao [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-11-28 17:37 Wilco Dijkstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=228b899bb5d90d1dd9a87ebc35924df309054447.camel@xry111.site \
--to=xry111@xry111.site \
--cc=Wilco.Dijkstra@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=cristian@rodriguez.im \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).