[Haskell-cafe] Re: FASTER primes
will_n48 at yahoo.com
Tue Jan 5 18:09:07 EST 2010
Daniel Fischer <daniel.is.fischer <at> web.de> writes:
> Am Montag 04 Januar 2010 22:25:28 schrieb Daniel Fischer:
> > memory still grows, but much slower, in my tests, due to the much smaller
> > GC time, it's a bit faster than the version with the original tfold.
> Not for larger inputs (but not so large that the tree-fold dies OOM).
> Fix rfold:
> rfold f [x] = x
> rfold f xs = rfold f (pairwise f xs)
> and it's faster also for those.
Niiice!!!! This is just great! :)
I tried a two-step feed BTW (that's three separate sets of lists) , with the
original structure. It ran with same speed as your new version (10..20% faster)
but with the memory of the previous one :) (80M for 8 mil primes vs the new
one's 10M). But your new structure is just great! I hoped there is something
better, that's why I posted it here in the first place.
'pairwise' puts odd leafs higher on the right. It might be better if it was so
on the left, for the frequency of production is higher.
Thanks a lot for your comments!
> Haskell-Cafe mailing list
> Haskell-Cafe <at> haskell.org
More information about the Haskell-Cafe