-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exponential runtime for [link](url) #9710
Comments
I can't do much without the file. You can email it to me; my email address is in pandoc.cabal in the top level of this repository. |
Thanks, sent you the file. In the meantime, I got a little closer to what might be the trigger, but I still fail to reproduce it with generic data.
|
I think the problem is the URLs with double Note: adding |
Here's a minimal case that takes 9s to parse on my machine:
|
For reference, your minimal case takes 12s on my machine. Thanks to your analysis I now found a minimal case that is way simpler: $ N=0; while ((N++<9)); do n=$((2*N)); for ((i=1;i<=n;i++)); do echo "[foo__bar](url)" ; done > tmp.md; start=${EPOCHREALTIME//[.,]}; echo -n "$n lines: "; pandoc tmp.md >/dev/null; echo $(((${EPOCHREALTIME//[.,]}-start)/1000)) ms ; done
2 lines: 24 ms
4 lines: 11 ms
6 lines: 34 ms
8 lines: 64 ms
10 lines: 154 ms
12 lines: 484 ms
14 lines: 1868 ms
16 lines: 7114 ms
18 lines: 28634 ms So, 18 lines of |
Substituting |
More data points in the hope they are of use for the debugging:
|
Commenting out The link parser grabs a string between Not sure about the exact fix yet but at least I now see the problem. |
(Apparently, I cannot add labels. Would have added: reader:markdown + performance.)
I ran into a case of exponential runtime for the Markdown reader that baffles me. Sadly, I was still not able to reproduce the bug with generic data. I cannot make my pathological file publicly available but I can share it privately upon request. The type of input is
The exponential runtime is obvious:
At this stage (following above code)
tmp.md
has 100 lines ofpathological.md
. I tried to run--trace
and I notice that the output seems broken:The Commonmark reader does not have this problem:
Baffling, too, is the effect of
s/^/* /
:Pandoc 3.1.13 on amd64 Debian GNU/Linux 11.9
The text was updated successfully, but these errors were encountered: