On 17 May 2012 03:31, Stephen Tetley <[email protected]> wrote: >> On 16 May 2012 19:43, wren ng thornton <[email protected]> wrote: > >>> You should probably farm out the toDot rendering to one of the libraries >>> that focuses on that[1], since they'll have focused on the efficiency >>> issues--- or if they haven't, then you can contribute improvements there, >>> helping everyone win. In particular, you're using Strings which is a >>> notorious performance sink. Using Text or ByteStrings would be far better. >>> > > I'm not sure swapping to Text or ByteStrings make be much great shakes > for this. If you are generating huge files, where it would count - > then the files are going to be a real problem for Graphviz to render > (unless Graphviz has seen some optimization recently...).
I found with graphviz that switching to Text gave two advantages: 1) Easier to require UTF-8 usage 2) Printing and parsing was faster In part, the speed-up came from switching to wl-pprint-text rather than pretty (the wl-pprint method of pretty-printing seems to have some efficiency improvements in how concatenation is done over pretty) and the Text backend for polyparse lets you use manySatisfy rather than (many . satisfy) which is more efficient. But even in my initial pseudo-port (going via String a lot, etc.) there was a slight speed-up. So I think there is still a valid reason to consider using Text (or possibly ByteString, but I think that has potential issues). > > That said, I would recommend Sönke uses a pretty print library rather > than Printf as using the former makes for much more idiomatic for > Haskell and generally performs well enough for "generational" > activities even if it uses Strings internally. > > Best wishes > > Stephen > > _______________________________________________ > Haskell-Cafe mailing list > [email protected] > http://www.haskell.org/mailman/listinfo/haskell-cafe -- Ivan Lazar Miljenovic [email protected] http://IvanMiljenovic.wordpress.com _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
