
I also get stack overflows from HughesPJ if I format something too big.
LW is more efficient by construction than HughesPJ. The only reason I
switched to HPJ from LW is that I could never get LW to behave as I
wanted, but I'll probably wind up writing my own simpler formatter due
to the HPJ stack overflow problem.
On Mon, Feb 4, 2013 at 5:36 AM, Johannes Waldmann
I was running into serious performance problems when printing moderately sized Doc and Xml data (HaXml goes via Doc).
So I replace Text.PrettyPrint.HughesPJ with Text.PrettyPrint.Leijen.Text, and patched the HaXml printer in the same way. Now it is running much faster.
This confirms some of the comments here: http://stackoverflow.com/questions/9761507/which-pretty-print-library
If you want to see for yourself, here is a test case. It constructs and prints a document tree with about 10^4 nodes, rendered to an Xml document with 10^6 (nonblank) chars: https://github.com/jwaldmann/haskell-tpdb/blob/master/test/speed.hs
Of the 4 output methods (fin the main program), only one takes < 1 second. Rendering via HughesPJ needs extra stack (!) and takes about 20 seconds. Rendering via Text.XML.HaXml.ByteStringPP seems much slower still (!)
(ghc-7.6.2, pretty-1.1.1.0, HaXml-1.23.3, wl-pprint-text-1.1.0.0, amd64, fedora 18, kernel 3.7.4)
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe