Hello,

breakUp s
        | L.null s = []
        | otherwise = h:(breakUp r) where
                (h,r) = L.splitAt 72 s

Running this on the 2G file blows up the stack pretty quickly, taking
the first 1 million records (there are 20M of them) with a big stack
parameter gives about 25% productivity, with GC taking the other 75%.

My understanding is that while this looks tail recursive, it isn't
really because of laziness.  I've tried throwing seq operators
around, but they don't seem to do much to help the efficiency.

The function is not tail-recursive as written (you're returning
h:breakUp r) but that shouldn't be a problem because of lazy
evaluation.

Can you give more context, particularly what happens to the result of breakUp?

-Jeff
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to