Commit eae4a9b
committed
perf: use O(1) hash set lookup for hyperlink scheme validation
Add SUPPORTED_SCHEMAS_LIST and isSupportedScheme() to ExternalReferenceResolver
for O(1) hash set lookup instead of regex matching against 371 IANA schemes.
This is ~6x faster than the 5600+ character regex pattern.
InlineLexer now uses ExternalReferenceResolver::isSupportedScheme() to
validate URI schemes during tokenization.
Note: This change is also in PR #1287 - when both PRs merge, the conflict
is trivially resolved by keeping one version.1 parent ad3c8de commit eae4a9b
2 files changed
Lines changed: 410 additions & 13 deletions
File tree
- packages
- guides-restructured-text/src/RestructuredText/Parser
- guides/src/ReferenceResolvers
Lines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | 62 | | |
66 | 63 | | |
67 | 64 | | |
| |||
164 | 161 | | |
165 | 162 | | |
166 | 163 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
173 | 167 | | |
174 | 168 | | |
175 | 169 | | |
| |||
0 commit comments