Closed michaelficarra closed 1 month ago
I don't think a string argument would work because the comparison would take too long and dwarf the pause time.
If the string argument value were interned, then it's just a pointer comparison and that's fine, but interned strings are an implementation detail. So if the user were to pass a non-interned string they would get very different timing behavior, which is pretty undesirable.
I'm not against the general idea here, but strings in particular I'm skeptical about.
With this design, we've completely removed the heuristics, and we allow the engine to manage the number of pauses.
Strong disagree with this characterization. You've made the heuristics to be more opaque and decoupled them from an integer, but the heuristics are definitely still there, if not more so.
Take the backoff strategy argument -- are we to enumerate a set of backoff strategies and prescribe exact behaviors for them? That's pretty bad, as the engine must be able to decide to not do anything for any argument if it decides the underlying CPU doesn't benefit from pausing.
Take the nonce -- an engine isn't going to use unlimited memory to track all possible nonces. Maybe an engine only tracks the most previous nonce (a cache with 1 entry), or some fixed N previous seen nonces for small N. More importantly, we shouldn't prescribe what to do.
Closing this per off-line conversations with @michaelficarra who found the response reasonable. Please reopen if incorrect.
In its current design, this proposal needs to use a heuristic to
And assuming it is able to do both of those accurately, it doesn't need the programmer to provide an iteration count. So why not just ask the programmer to provide those things instead? Something like this:
The parameters would be
With this design, we've completely removed the heuristics, and we allow the engine to manage the number of pauses.