[Haskell-cafe] ANNOUNCE: set-monad
rendel at informatik.uni-marburg.de
Sun Jun 17 08:26:26 CEST 2012
David Menendez wrote:
> As you noticed, you can get somewhat better performance by using the
> combinators that convert to S.Set internally, because they eliminate
> redundant computations later on.
"Somewhat better"? My example was three times faster, and I guess that
the fast variant is O(n) and the slow variant is O(n²). So I expect that
for some applications, the Set interface is more than fast enough and
the MonadPlus-interface is much too slow.
>> (Why is unioned faster then numbers? Is union doing some rebalancing? Can I
>> trigger that effect directly?)
> It's because mplus a b>>= f turns into mplus (a>>= f) (b>>= f),
> whereas unioned takes the union before calling f.
Here, you compare mplused to unioned, but in the parentheses, I asked
about numbers and unioned (from my last email).
More information about the Haskell-Cafe