Commit 6a14fda
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 phpDocumentor#1287 - when both PRs merge, the conflict
is trivially resolved by keeping one version.1 parent e4ad9eb commit 6a14fda
File tree
2 files changed
+410
-13
lines changed- packages
- guides-restructured-text/src/RestructuredText/Parser
- guides/src/ReferenceResolvers
2 files changed
+410
-13
lines changedLines changed: 3 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | 58 | | |
62 | 59 | | |
63 | 60 | | |
| |||
165 | 162 | | |
166 | 163 | | |
167 | 164 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
174 | 168 | | |
175 | 169 | | |
176 | 170 | | |
| |||
0 commit comments