了解Wadler的Prettier打印机的性能特征

时间:2017-09-03 10:16:42

标签: pretty-print idris

我正在使用contribIdris库中的Prettier打印机实现。

当我在|//|列表中使用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."

此处可以看到Doc adt版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."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

1 个答案:

答案 0 :(得分:1)

这可能不是一个答案,但它可以为更好地理解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分析结果: enter image description here

正如我们从线程转储中看到的,这个方法调用Text.PrettyPrint.WL.Core.render$colonbest$colon0不断重复  堆栈跟踪,从CPU分析,该功能是最热门的。此方法对应于best可用模块hererender函数中定义的Text.PrettyPrint.WL.Core函数。我对这段代码不是很熟悉,但看起来best function一直在调用自己,而不会终止递归。