Skip to content

Commit 796047d

Browse files
dbussinkvmg
andcommitted
innodb: use a properly distributed PRNG (mysql#83)
The "fast" prng algorithm was really poorly distributed and only used a system counter as input. This was causing failures somehow specifically on Ubuntu Jammy, but it's a broken fast prng by design. Instead, this PR uses shishua (https://github.com/espadrine/shishua) as a PRNG. We have replaced both the slow and fast PRNGs with this new implementation because it offers better randomness for both cases and it's competitive in micro-benchmarks. Before/baseline: [ RUN ] Microbenchmarks.BM_RND_GEN BM_RND_GEN 16593 iterations 60199 ns/iter 15.84 MB/sec [ OK ] Microbenchmarks.BM_RND_GEN (1004 ms) [ RUN ] Microbenchmarks.BM_RND_GEN_FAST BM_RND_GEN_FAST 50909 iterations 19610 ns/iter 48.63 MB/sec [ OK ] Microbenchmarks.BM_RND_GEN_FAST (1000 ms) After/xishua: [ RUN ] Microbenchmarks.BM_RND_GEN BM_RND_GEN 42351 iterations 23475 ns/iter 40.63 MB/sec [ OK ] Microbenchmarks.BM_RND_GEN (996 ms) [ RUN ] Microbenchmarks.BM_RND_GEN_FAST BM_RND_GEN_FAST 41897 iterations 23845 ns/iter 40.00 MB/sec [ OK ] Microbenchmarks.BM_RND_GEN_FAST (1001 ms) Signed-off-by: Dirkjan Bussink <[email protected]> Signed-off-by: Vicent Marti <[email protected]> Co-authored-by: Vicent Marti <[email protected]> Signed-off-by: Dirkjan Bussink <[email protected]>
1 parent 60a8f40 commit 796047d

File tree

5 files changed

+737
-17
lines changed

5 files changed

+737
-17
lines changed

0 commit comments

Comments
 (0)