3 ms·
Why is it so much faster than `uuid`?
by throwaway894345 1y ago
Why is it so much faster than `uuid`?
- sdrapkin 1y agoIt generates entropy 4kb-at-a-time (instead of on each call), and uses a cache-pool instead of single cache behind a lock (which is what standard uuid does in "RandPool=ON" mode).
- cyberax 1y agoSo this automatically makes it unsafe in case of VM snapshots. The Linux kernel now has an optimization that makes it safe: https://lwn.net/Articles/983186/ https://lwn.net/Articles/983186/ Go should automatically benefit from this, if they use the vDSO getrandom().
- maxmcd 1y agoAh cool, the note here is also interesting: https://pkg.go.dev/github.com/google/uuid#EnableRandPool https://pkg.go.dev/github.com/google/uuid#EnableRandPool