[Haskell-beginners] Printing the entries of a Data.Map m
Matthias Guedemann
matthias.guedemann at ovgu.de
Sun May 15 11:34:33 CEST 2011
Hi Manfred
> It didn't make much of a difference in runtime doing it without toList.
> I'm not quite sure if it is really more efficient or not. Perhaps I
> would have to create dictonary with some millions entries in order to
> see a noticable difference?
Probably, Haskell is not very deterministic for memory / runtime
forecasts :-)
In theory there should be no difference in complexity, both need one
sweep over all entries of the Map. There could perhaps be a constant
cost for constructing the list. Nevertheless, laziness should make it
possible to run in constant space, as neither the list, nor the
transformed Map is used. So differences are probably small.
But is possible, take some measurements and report, not just runtime,
but also heap space usage.
regards
Matthias
More information about the Beginners
mailing list