Repository navigation
Conversation
InlineProcessor.__handleInline got each pattern with an integer index into the Registry. Each index checks the sort order and the key type, and looks up the item by name. InlineProcessor.run now gets the sorted list once, and __handleInline indexes that list.
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.
Description
InlineProcessor.__handleInlinegets each inline pattern with an integer index into theRegistry. Each index checks the sort order and the key type, and finds the item by name. This change gets the sorted list of patterns one time inInlineProcessor.run. Then__handleInlineuses an index into that list. The output does not change.markdown.markdown()inputREADME.md(85 kB)HISTORY.md(65 kB)docs/changelog.mddocs/contributing.md,extra+tocextra+toc+smartyREADME.mdHello *world*paragraphI measured no slowdown on 23 inputs. These include a single word, documents with only code blocks, and documents with only headings. I used 20 interleaved rounds and a Mann-Whitney test (Apple M5, CPython 3.14). CPython 3.11 and 3.15 gave the same results. On PyPy 3.11, the change was in the noise range of old against old. Import time did not change (30 rounds). I did not measure other architectures.
Checks:
python -m unittest discover testspasses on CPython 3.11, 3.14, 3.15 and PyPy 3.11, and with Pygments 2.7.1.flake8 markdown testspasses.docs/andtests/. I used 10 sets of extensions and both output formats.AI Assistance Disclosure
No AI tools were used in preparing this PR.
AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.
AI tools were use to assist with the following:
Checklist