3 ms·
If you squint a bit, many of the optimizations for quicksort are essentially a very short Monte Carlo simulation. Randomness seems to help more with intentiona
by hinkley 1y ago
If you squint a bit, many of the optimizations for quicksort are essentially a very short Monte Carlo simulation.
Randomness seems to help more with intentionally belligerent users than anything else. There is no worst pattern because the same question twice yields a different result. For internal use that can help a little with batch processing, because the last time I did that seriously I found a big problem with clustering of outlier workloads. One team of users had 8-10x the cost of any other team. But since this work involved populating several caches, I sorted by user instead of team and that sorted it. Also meant that one request for team A was more likely to arrive after another request had populated the team data in cache instead of two of them concurrently asking the same questions. So it not only smoothed out server load it also reduced the overall read intensity a bit. But shuffling the data worked almost as well and took,hours instead of days.
- jvanderbot 1y agoAdversary input is basically at the core of analysis of these types of algorithms, yes. Here's another crossover analogy. In games, for any deterministic strategy there are games where you can't play a deterministic (pure) strategy and hope to get the best outcome, you need randomized (mixed) ones. Otherwise the Adversary could have anticipated and generated a different pathological response.
- hinkley 1y agoI think this started though with systems doing incremental work and then passing the result on to an algorithm that does worse with partially sorted or inverted lists than with random ones. Adversarial came later, particularly with the spread of the Internet.
- jvanderbot 1y agoI assure you adversarial analysis predates the internet