gpt4 book ai didi

pretty-print - 了解 Wadler 的 Prettier 打印机的性能特点

转载 作者:行者123 更新时间:2023-12-04 04:55:48 25 4
gpt4 key购买 nike

我正在使用 contrib 中的 Prettier Printer 实现。 Idris 中的图书馆.

当我用 |//| 弃牌时Doc 列表中的运算符s,性能迅速爆发,即在我失去耐心之前,以下代码不会终止:

*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 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." 的 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 分析结果:
enter image description here

从线程转储中可以看出,这个方法调用了 Text.PrettyPrint.WL.Core.render$colonbest$colon0不断重复
堆栈跟踪,从 CPU 分析来看,该函数是 HitTest 门的地方。该方法对应 best render 中定义的函数 Text.PrettyPrint.WL.Core的功能可用模块 here .我对这段代码不太熟悉,但它看起来像 best function不断调用自己而不终止递归。

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

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com