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
Extreme slowdown with fenced code blocks extension on big files #148
Comments
The current implementation is simple, but quite inefficient. I expect a large part of the inefficiency is due to the simple fix for issue #45 (see PRs #56 and #60). It's done by doing additional passes over the input, and possibly rewriting it to allow further passes to work correctly (using up more memory and creating additional work for GC). I think an optimization effort that preserves correct behavior would be welcome. Unfortunately, I don't have spare cycles for this now, but I can help review any PRs. |
I try to fix this issue in the PR #149, could you help to review? Thanks. |
@holmstrom, can you share the content of I'd like to add these benchmarks to blackfriday so it's possible to avoid regressions (like when fixing #279). |
In first pass, there may not be a trailing newline after a fenced code block yet. Make newline optional in isFenceLine when calling fencedCodeBlock to detect the fenced code block it anyway. This is more complex, but it avoids creating temporary buffers or modifying input in order to maintain performance (see #148). Document and rename fencedCode to fencedCodeBlock. Add regression tests. Fixes #279.
In first pass, there may not be a trailing newline after a fenced code block yet. Make newline optional in isFenceLine when calling fencedCodeBlock to detect the fenced code block it anyway. This is more complex, but it avoids creating temporary buffers or modifying input in order to maintain performance (see #148). Document and rename fencedCode to fencedCodeBlock. Add regression tests. Fixes #279.
It seems using
EXTENSION_FENCED_CODE
slows down the markdown parsing significantly. I noticed this while doing parsing on about 300 x 50k files with mixed content. The parsing was slower than I thought it should be so I started playing with the extensions and noticed thatEXTENSION_FENCED_CODE
had an extreme effect on performance. See below for the numbers I got.Bench output
Note it's not just a linear increase with size.
Code
The text was updated successfully, but these errors were encountered: