haskell-prettyprinter / haskell-prettyprinter/prettyprinter

Optimization potential

Open
#121 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

In https://github.com/quchen/prettyprinter/pull/116#issuecomment-577204724 I shared a profile from a `prettyprinter`-heavy `dhall` task. Multiple functions from `prettyprinter` and `prettyprinter-ansi-terminal` show up:

```
COST CENTRE MODULE SRC %time %alloc
layoutWadlerLeijen Data.Text.Prettyprint.Doc.Internal src/Data/Text/Prettyprint/Doc/Internal.hs:(1775,1)-(1843,60) 5.5 3.0
renderLazy Data.Text.Prettyprint.Doc.Render.Terminal.Internal src/Data/Text/Prettyprint/Doc/Render/Terminal/Internal.hs:(108,1)-(148,60) 3.7 3.7
removeTrailingWhitespace Data.Text.Prettyprint.Doc.Internal src/Data/Text/Prettyprint/Doc/Internal.hs:(1477,1)-(1537,119) 2.3 1.1
styleToRawText Data.Text.Prettyprint.Doc.Render.Terminal.Internal src/Data/Text/Prettyprint/Doc/Render/Terminal/Internal.hs:(278,1)-(304,29) 1.8 2.0
layoutSmart Data.Text.Prettyprint.Doc.Internal src/Data/Text/Prettyprint/Doc/Internal.hs:(1741,1)-(1767,59) 1.6 0.2
changesUponFlattening Data.Text.Prettyprint.Doc.Internal src/Data/Text/Prettyprint/Doc/Internal.hs:(567,1)-(607,21) 1.5 1.1
```

The most interesting candidates are IMHO `removeTrailingWhitespace` and `styleToRawText`:

https://github.com/quchen/prettyprinter/blob/fa8ed27217af75b1515cf1ef0b0c0be33dc2f5b0/prettyprinter/src/Data/Text/Prettyprint/Doc/Internal.hs#L1458-L1519

https://github.com/quchen/prettyprinter/blob/fa8ed27217af75b1515cf1ef0b0c0be33dc2f5b0/prettyprinter-ansi-terminal/src/Data/Text/Prettyprint/Doc/Render/Terminal/Internal.hs#L291-L318

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.