Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Mirage crypto RNG instead of reading from /dev/urandom
/dev/urandom may not be available. mirage-crypto can use getrandom syscall if needed. This is now fast enough that we don't need the Random based generator: ``` ╭───────────────────────────────────────┬───────────────────────────┬───────────────────────────┬───────────────────────────╮ │name │ major-allocated │ minor-allocated │ monotonic-clock │ ├───────────────────────────────────────┼───────────────────────────┼───────────────────────────┼───────────────────────────┤ │ uuidx creation/Uuidx.make │ 0.0080 mjw/run│ 58.0004 mnw/run│ 375.5079 ns/run│ │ uuidx creation/Uuidx.make_uuid_urnd │ 0.0000 mjw/run│ 19.0059 mnw/run│ 5510.3318 ns/run│ ╰───────────────────────────────────────┴───────────────────────────┴───────────────────────────┴───────────────────────────╯ ``` Using Random would be ~4x faster, but Fortuna is already >10x faster than /dev/urandom and avoids using system calls, except for seeding: ``` │ uuidx creation/Uuidx.make │ 0.0000 mjw/run│ 19.0001 mnw/run│ 95.5587 ns/run│ ``` There is also a newer version of mirage-crypto-rng that can avoid the Cstruct and give us the string more directly, which we'll soon upgrade to. Signed-off-by: Edwin Török <[email protected]>
- Loading branch information