Skip to content

Conversation

@kivikakk
Copy link
Contributor

We had a bug bounty report where consecutive reference definitions take a long time in parse, rather than reference lookup. Here's a repro:

~/github/cmark upstream-master$ time python -c 'print("[a]: u\n" * 1 * 50000)' | build/src/cmark
build/src/cmark  0.51s user 0.01s system 93% cpu 0.553 total
~/github/cmark upstream-master$ time python -c 'print("[a]: u\n" * 2 * 50000)' | build/src/cmark
build/src/cmark  1.71s user 0.00s system 98% cpu 1.735 total
~/github/cmark upstream-master$ time python -c 'print("[a]: u\n" * 3 * 50000)' | build/src/cmark
build/src/cmark  3.66s user 0.03s system 98% cpu 3.723 total
~/github/cmark upstream-master$ time python -c 'print("[a]: u\n" * 4 * 50000)' | build/src/cmark
build/src/cmark  6.46s user 0.02s system 99% cpu 6.539 total
~/github/cmark upstream-master$ time python -c 'print("[a]: u\n" * 5 * 50000)' | build/src/cmark
build/src/cmark  9.61s user 0.07s system 99% cpu 9.755 total
~/github/cmark upstream-master$ time python -c 'print("[a]: u\n" * 16 * 50000)' | build/src/cmark
build/src/cmark  106.81s user 0.71s system 99% cpu 1:48.26 total

More details to follow, but @vmg put this fix together which is live on our end now.

@jgm jgm merged commit ec9db91 into commonmark:master Sep 14, 2017
@jgm
Copy link
Member

jgm commented Sep 14, 2017

Great, thanks!

@kivikakk kivikakk deleted the upstream/refparse branch September 14, 2017 03:55
kivikakk added a commit to kivikakk/comrak that referenced this pull request Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants