haskell-prettyprinter / haskell-prettyprinter/prettyprinter

Is it possible to cut on expensive computations when the layout is unbounded?

Open
#215 3 comments 0 reactions 0 assignees View on GitHub
Performance
Dominant language
Haskell
Stars
309
Forks
43
Avg merge
21h 25m
Merged PRs (30d)
1

Description

Hello,

I have a very large document that, when printed, takes about 30 seconds if I define `commas = fillSep . punctuate commas`, but only takes 3 seconds if I define it as `commas = hsep . puncuate commas`.

Now this discrepancy is possibly acceptable, given `fillSep` ought to do more work in general. But even when setting the layout to `Unbounded`, we seem to pay the hefty price of `fillSep`, even though, unless I'm mistaken, we get the same output that `hsep` would have given.

This can be annoying if a project provides a `fillSep`-based printer, but lets the layout to its clients, who then pay the layout price even if they don't really need to.

I may try to give a minimized example later, but my actual project has 30MB input files and a large code base so it's not the ideal setting to minimize.

Also note that the same problem happens with the `pretty` package.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.