2019-09: isKeywordEnabled does an O(vocabularies) scan per keyword
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- typescript
- Domain
- performance
Research direction
Start in src/services/vocabularies.ts and inspect isKeywordEnabled, especially its per-keyword vocabulary scan. Trace how vocabularyKeywords and activeVocabularies are used, then verify the existing behavior while replacing repeated scans with the suggested reverse lookup. Done means keyword checks preserve the current results without iterating all vocabularies each time.
Written by the indexing model from the issue text.
Description
Found while reviewing #308 (JSON Schema 2019-09 support).
Problem
isKeywordEnabled in src/services/vocabularies.ts iterates Object.entries(vocabularyKeywords) (all vocabularies and their keyword arrays) for every keyword check, and this runs per keyword per node during validation when vocabularies are active.
for (const [vocabUri, keywords] of Object.entries(vocabularyKeywords)) {
if (keywords.includes(keyword) && activeVocabularies.has(vocabUri)) {
return true;
}
}
Suggested direction
Precompute a reverse keyword -> Set<vocabUri> map once at module load and do a single lookup.
Severity
Low — minor perf, only when activeVocabularies is present.
- Dominant language
- TypeScript
- Stars
- 326
- Forks
- 145
- Avg merge
- 22h 10m
- Merged PRs (30d)
- 9
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-json-languageservice
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
microsoft/vscode-json-languageservice#356 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
microsoft/vscode-json-languageservice#354 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/vscode-json-languageservice#350 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
All issues in microsoft/vscode-json-languageservice
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100