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.
Found while reviewing #308 (JSON Schema 2019-09 support).
Problem
isKeywordEnabledinsrc/services/vocabularies.tsiteratesObject.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.Suggested direction
Precompute a reverse
keyword -> Set<vocabUri>map once at module load and do a single lookup.Severity
Low — minor perf, only when
activeVocabulariesis present.