Ticket #2028 (new bug)
STM slightly conservative on write-only transactions
|Reported by:||JulesBean||Owned by:|
|Type of failure:||Runtime performance bug||Difficulty:||Unknown|
|Test Case:||Blocked By:|
The STM appears to be slightly too conservative on write-only transactions.
It will store a copy of the current (that is, old) value on a writeTVar, even if it was never read from. This can cause a spurious retry.
E.g. atomically $ writeTVar tv 0 really has no reason to ever retry. Neither, in fact, does atomically $ mapM (\tv -> writeTVar tv 0) [tv1,tv2,tv3,tv4].
My suggestion is to instead indicate "no prior value" for that TVar, and then make no consistency checks on TVars marked as no prior value...