我正在使用contrib中的Idris库中的Prettier Printer实现。

当我用|//|运算符折叠到Doc列表上时,性能迅速爆炸,即以下代码在我失去耐心之前没有终止:

*IdrisFMT\PrettyDocs> :exec toString 0 15 $ fold (|//|) $ map text $ words "this is a long sentence with a lot of words that I can use for testing the performance of the prettier printer implementation. I need a few more words to prove my point, though."

请注意,以上折合等于预定义的组合器fillCat

如果我改用预定义的cat组合器(= group . vcat),则它会在一秒钟内终止:
*IdrisFMT\PrettyDocs> :exec toString 0 15 $ cat $ map text $ words "this is a long sentence with a lot of words that I can use for testing the performance of the prettier printer implementation. I need a few more words to prove my point, though."
"this\nis\na\nlong\nsentence\nwith\na\nlot\nof\nwords\nthat\nI\ncan\nuse\nfor\ntesting\nthe\nperformance\nof\nthe\nprettier\nprinter\nimplementation.\nI\nneed\na\nfew\nmore\nwords\nto\nprove\nmy\npoint,\nthough."

可以在此处看到Doccat $ map text $ words "this is a long sentence with a lot of words that I can use for testing the performance of the prettier printer implementation. I need a few more words to prove my point, though." adt版本:https://pastebin.com/4AJWcGnD

我知道cat组合器解决了一个简单得多的问题,但是我看不到fillCat如此复杂,以至于永不终止。

这可能是由于实现中的错误导致的,还是我只是在构造过于复杂的文档?

编辑
|//|运算符的定义在这里找到:
https://github.com/idris-lang/Idris-dev/blob/master/libs/contrib/Text/PrettyPrint/WL/Combinators.idr#L65-L69
||| The document `(x |//| y)` concatenates document `x` and `y` with
||| a 'softbreak' in between. This effectively puts `x` and `y` either
||| right next to each other or underneath each other.
(|//|) : Doc -> Doc -> Doc
(|//|) = concatDoc softBreak

最佳答案

这可能不是答案,但可能会给对prettyprint库有更好理解的人一些提示。当我在后端上工作时,我使用Idris JVM bytecode backend进行了诊断,并且很好奇它在JVM上的行为。毫不奇怪,行为是相同的:第一个代码段只是挂起,第二个代码段可以正常工作,但是要进行调试,我能够使用JVM工具 jvisualvm 来进行线程转储和配置CPU。

这是线程转储:

java.lang.Thread.State: RUNNABLE
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at main.Main.lambda$$lbraceText$dotPrettyPrint$dotWL$dotCore$dotrender$colonbest$colon0_lam_0$rbrace$26(Unknown Source)
        at main.Main$$Lambda$18/189568618.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at Text.PrettyPrint.WL.Core.render$colonbest$colon0(Unknown Source)
        at Text.PrettyPrint.WL.Core.lambda$render$1(Unknown Source)
        at Text.PrettyPrint.WL.Core$$Lambda$16/1531448569.call(Unknown Source)
        at io.github.mmhelloworld.idrisjvm.runtime.Runtime.unwrap(Runtime.java:37)
        at main.Main.main(Unknown Source)
        at main.Main.$lbracerunMain_0$rbrace(Unknown Source)
        at main.Main.main(Unknown Source)

来自jvisualvm的CPU分析结果:
pretty-print - 了解Wadler pretty-print 的性能特征-LMLPHP

从线程转储中我们可以看到,此方法调用Text.PrettyPrint.WL.Core.render$colonbest$colon0
堆栈跟踪,从CPU性能分析来看,该功能是 HitTest 门的地方。此方法对应于在可用herebest模块的render函数中定义的Text.PrettyPrint.WL.Core函数。我对这段代码不太熟悉,但是看起来 best function一直在调用自身而不会终止递归。

关于pretty-print - 了解Wadler pretty-print 的性能特征,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46022386/

10-13 02:55