Skip to content
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

Parsing []([]([](… takes quadratic time #732

Closed
andersk opened this issue Nov 18, 2020 · 1 comment
Closed

Parsing []([]([](… takes quadratic time #732

andersk opened this issue Nov 18, 2020 · 1 comment

Comments

@andersk
Copy link

andersk commented Nov 18, 2020

$ time node -e 'require("markdown-it")().render("[](".repeat(10000))'
0.65user 0.00system 0:00.64elapsed 102%CPU (0avgtext+0avgdata 39344maxresident)k
0inputs+0outputs (0major+3738minor)pagefaults 0swaps
$ time node -e 'require("markdown-it")().render("[](".repeat(20000))'
2.07user 0.01system 0:02.07elapsed 100%CPU (0avgtext+0avgdata 41020maxresident)k
0inputs+0outputs (0major+4152minor)pagefaults 0swaps
$ time node -e 'require("markdown-it")().render("[](".repeat(40000))'
7.39user 0.01system 0:07.39elapsed 100%CPU (0avgtext+0avgdata 44988maxresident)k
0inputs+0outputs (0major+5041minor)pagefaults 0swaps
$ time node -e 'require("markdown-it")().render("[](".repeat(80000))'
32.20user 0.01system 0:32.21elapsed 100%CPU (0avgtext+0avgdata 50544maxresident)k
0inputs+0outputs (0major+8210minor)pagefaults 0swaps

(See also #583, commonmark/cmark#214, commonmark/commonmark.js#129.)

rlidwka added a commit that referenced this issue Nov 19, 2020
rlidwka added a commit that referenced this issue Nov 19, 2020
Allow no more than 32 levels of nesting in `[]( (((((....))))) )`
for performance reasons.

close #732
@rlidwka
Copy link
Member

rlidwka commented Nov 19, 2020

Fixed, thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants