Repository navigation
Conversation
The even-space trim scanned each code span with a regex that retried a long run of spaces. A linear walk removes the same margin, including layered space and tab runs, and still leaves a newline untouched.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1889.
RDoc::Markdown#codetrimmed a matching space or tab margin with a pattern that required the same run at both ends, and it retried that pattern in a loop. On a long run of spaces the match backtracks, so one inline code span can occupy a core for seconds. A span of 4,000 spaces took several seconds; 20,000 is far slower.The margin is now removed with a linear walk. It still peels a leading run of spaces or tabs only when the same run is a suffix, and it still leaves text that contains a newline unchanged. The parser source and the generated parser both carry the change.
Markdown tests: 127 tests, 0 failures. The MarkdownTest 1.0.3 suite: 22 tests, 0 failures. The parser suite: 3 tests, 0 failures. The new assertion trims a 20,000-space span in under half a second.