perf(compiler): pre-compute maxCRNameLength for perf

This commit is contained in:
Evan You
2019-11-16 16:19:47 -05:00
parent 2780e0df4c
commit 1de072567d
2 changed files with 11 additions and 8 deletions

View File

@@ -7,5 +7,9 @@ export const parserOptionsStandard: ParserOptions = {
...parserOptionsMinimal,
// https://html.spec.whatwg.org/multipage/named-characters.html#named-character-references
namedCharacterReferences
namedCharacterReferences,
maxCRNameLength: Object.keys(namedCharacterReferences).reduce(
(max, name) => Math.max(max, name.length),
0
)
}