Looking at the implementation of DiffArrays, there are some obvious
optimisations that aren't done.

.... and don't forget that it uses MVar instead of IORef to be thread-safe

I don't see any obvious optimisations there - some kind of thread-safety is essential. We could try IORef and atomicModifyIORef, but I doubt it would be much quicker, if at all. The other optimisations I mentioned are easy wins, though.

it does look as if the measures for thread-safety protect us from the case in 
which
DiffArray shouldn't be used anyway, slowing down the intended use case. though
one could probably come up with a program that accesses a DiffArray in a single-
threaded manner from a sequence of different Haskell threads;) that does not 
seem
a likely usage scenario, does it?

is there a way to make DiffArray access thread-specific, so that accessing a
DiffArray from a different thread would make a copy specific to that thread, similar to how old versions are handled, while each thread has fast access to its own DAs?

how big is the impact of those MVars anyway, compared to a version that wouldn't
have to worry about threads?

claus


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to