[Haskell-cafe] Time consumption nub

Arie Groeneveld bradypus at xs4all.nl
Wed Jul 18 07:38:38 EDT 2007


Hi,

Wondering about time space consuming:  'nub' vs 'map head.group.sort'

Consider:

ry = [1..10000] ++ replicate 13 5 ++ replicate 21 34



*Main> length . nub $ ry
10000
(5.18 secs, 1050000 bytes)

*Main> length . map head . group . sort $ ry
10000
(0.03 secs, 6293384 bytes)

       Time     space
nub     ---      +
fnub    +++      -

+ is better ;-)

Thanks

@@i=arie



More information about the Haskell-Cafe mailing list