Stop using "Int" for microsecond delays in "base"
iridcode at gmail.com
Thu Mar 31 11:37:00 CEST 2011
2011/3/30 Daniel Fischer <daniel.is.fischer at googlemail.com>
> On Wednesday 30 March 2011 20:47:37, Wolfgang Jeltsch wrote:
> > Can’t Integer be implemented in a more efficient way that it’s done
> > currently?
> Theoretically, sure. Practically, everything above a minor speedup would be
> very hard, I think.
> And, as Johan mentioned, Integers can't be unpacked, I don't see how that
> could be achieved, so for IntMap and the like, performance would be
> drastically worse even if Integer manipulation itself got significantly
I'm not sure, if an IntegerMap would be that much slower for Int-sized
Integers. An optimized variant of the following trie-like data structure
data IntegerMap v = IntegerMap (IntMap v) (M.Map Integer v) -- better:
also use a trie-based impl. for M.Map Integer v
should do the trick with a small constant overhead for Int-sized Integers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libraries