
Dear Jeff,
Is it possible that your size pre-calculation is inadvertently inducing quadratic behavior?
Could be, but I don't think so, this looks pretty much linear ghci> T.length $ L.toStrict $ renderT $ vcat $ replicate 100000 "." 199999 (0.94 secs, 468,241,960 bytes) ghci> T.length $ L.toStrict $ renderT $ vcat $ replicate 200000 "." 399999 (1.83 secs, 935,759,344 bytes) ghci> T.length $ L.toStrict $ renderT $ vcat $ replicate 300000 "." 599999 (2.80 secs, 1,403,276,848 bytes) But that last expression with wl-pprint-text gives ghci> T.length $ L.toStrict $ displayT $ renderPretty 0.5 80 $ vcat $ replicate 300000 "." 599999 (0.27 secs, 426,008,296 bytes) Oh, and now I realize - my measurement was all wrong since ghci interprets my code (bytecode) but has the library compiled. (the asymptotics is still OK). When I compile my code first, I do get ghci> T.length $ L.toStrict $ renderT $ vcat $ replicate 300000 "." 599999 (0.27 secs, 459,427,808 bytes) and that's on par. (as it should be - I am using wl-pprint-text:SimpleDoc in the end.) So, with that out of the way, can we go back to discussing semantics please :-) Have you seen 'nest' (increase indentation level) and 'skip' (to that level, possibly with line feed) before? Is this `hang` of the Wadler-Leijen printer, somehow? The basic idea (p. 2) https://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf is the same "indentation is added only at an explicit newline, not at the beginning of a string." That paper was written before the "dutch layout style" (separators at start of lines) became popular? So it is missing the examples that I am after. The libray https://hackage.haskell.org/package/wl-pprint-text-1.2.0.2/docs/Text-PrettyP... scares me because it mentions "three new primitives" (in extension of the paper). But it is super fast! Best regards, J.