
28 Oct
2011
28 Oct
'11
6:15 a.m.
David Barbour wrote:
Create an extra TVar Int for every `chunk` in the array (e.g every 256 elements, tuned to your update patterns). Read-write it (increment it, be sure to force evaluation) just before every time you write an element or slice it or slice the array element.
Incrementing and forcing evaluation should not be necessary, a TVar () should be enough. I would be very much surprised if the internal STM machinery compares the actual _values_ of what is inside a TVar, I guess it just notes that a read or a write happened. Anyway, this is just a guess, I wonder if these details are documented somewhere... Cheers Ben