diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2019-11-24 21:39:05 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2019-11-24 21:59:39 -0800 |
commit | 7857405e735fcf4542f9022d8f9e00c176f86597 (patch) | |
tree | f2de6a16e9a095419fee6fc17c755cdffbd85fc7 /src/libs/din/din.h | |
parent | 4d87a91891a2ff29f399edebfcd3590316a14445 (diff) |
snow: per-cpu rand_r() seed state
Snow was already threaded, but used a global seed with rand_r() meaning
the CPUs were hammering on the same address. There wasn't any locking or
atomics, as it isn't terribly critical when generating white noise if the
seed access is racy. But the writes still caused cache lines to ping-pong.
This commit gives a ~15.5% speedup in my measurements on an i7-2640M.
Note without the padded union, using just an array of ints, zero gain
is realized. I used a padding of 256 just to have some headroom, x86
is 64 but other CPUs vary, POWER9 is 128 for example.
Diffstat (limited to 'src/libs/din/din.h')
0 files changed, 0 insertions, 0 deletions