
14 Mar
2012
14 Mar
'12
8:56 p.m.
On Wed, Mar 14, 2012 at 5:50 PM, wren ng thornton
Do note, however, that in certain cases the ST approach can be much slower than the obvious immutable approach (i.e., the State monad--- especially when implemented directly via argument passing, rather than using the monadic interface). I have some closed-source code where that assumption bit me; the ST code was over 4x slower.
An additional reason is that runST often allocates a closure (as it's marked NOINLINE) and thus using it e.g. in a tight loop can increase allocation. -- Johan