prettyprinter icon indicating copy to clipboard operation
prettyprinter copied to clipboard

renderIO documentation is suspect, performance of renderLazy + hPutStr is better

Open vmchale opened this issue 4 years ago • 5 comments
trafficstars

The renderIO documentation says that it is more efficient, but it seems to be slower when writing to files on Linux.

I recently switched things around in one of my projects to make it faster! https://github.com/vmchale/kempe/commit/59a73c5a8606dd3377b196049e63b44105c33a24

vmchale avatar Mar 19 '21 21:03 vmchale

Thanks for the report, Vanessa! :)

Which GHC version did you experience this with?

BTW, if performance is very important in your usecase, you could try using layoutCompact instead of layoutPretty.

sjakobi avatar Mar 19 '21 21:03 sjakobi

GHC 9.0.1!

Thanks, I will!

I might be mistakenly not using hFlush let me see :thinking:

vmchale avatar Mar 20 '21 13:03 vmchale

Hm, I don't think that's hFlush.

I'll look at layoutCompact, thank you!

vmchale avatar Mar 20 '21 13:03 vmchale

So text is reported to show massive performance regressions with GHC 9.0.1: https://gitlab.haskell.org/ghc/ghc/-/issues/19557

I think we should wait for GHC 9.0.2 and the next text release and then take another look.

sjakobi avatar Mar 20 '21 15:03 sjakobi

In general I’m in favor for phasing out the renderIO etc. functions – there are too many combinations of layouting, rendering, and IO-ing. Typically everyone writes their own combinations anyway, and renderIO is only a very specific use case that clutters the API.

quchen avatar Jun 08 '21 09:06 quchen