We got a PR to change reservoir sampling from using java.util.Random to
java.util.ThreadLocalRandom, saying it sped up a multithreaded app
significantly. In a scenario with multiple threads writing to independent
reservoirs, ThreadLocalRandom really should avoid a lot of locks, so that's
fine.

The only drawback I see is that it makes deterministic, reproducible
testing impossible since you can't set the seed for ThreadLocalRanom.
That's ultimately a good thing -- it'd be a terrible design to have
separate reservoirs initialized with the same seed! And our tests already
don't pick a seed.

I'm inclined to approve the PR, and even to go farther and recommend that
we (eventually) move to TLRandom more generally. But I first wanted to see
if there's some unknown drawback of which I am not currently aware?

  jon

Reply via email to