Has anyone ever done application-layer speculative execution before, and how did...

@azonenberg@ioc.exchange

Has anyone ever done application-layer speculative execution before, and how did it turn out if so?

Scenario: you have an expensive, high-latency operation whose result determines the exact configuration of a second expensive, high-latency configuration.

The two operations can be batched and complete much faster if you know the configuration of the second in advance, but you don't. But the second operation has no side effects (so it's safe to throw away the output and do it again).

So instead, just batch them taking a reasonable guess of the configuration for the second operation, then throw it away and re-run with the correct configuration after the batch completes if you got it wrong.

As long as you can guess right often enough that the savings from the avoided sync-point latency exceeds the cost of the branch mispredictions, it should be a net throughput improvement.