Skip to content

Commit

Permalink
small performance improvement by having the query array set as a cons…
Browse files Browse the repository at this point in the history
…tant instead of creating the array in every call
  • Loading branch information
Janther committed Dec 18, 2024
1 parent 8652dcb commit 3d2dcdc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/slang-utils/create-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ const milestoneVersions = Array.from(
return versions;
}, []);

const query = Query.parse(
'[VersionPragma @versionRanges [VersionExpressionSets]]'
);
const queries = [
Query.parse('[VersionPragma @versionRanges [VersionExpressionSets]]')
];

let parser: Parser;

Expand Down Expand Up @@ -112,7 +112,7 @@ function tryToCollectPragmas(
parser: Parser,
isCachedParser = false
): string[] {
const matches = parseOutput.createTreeCursor().query([query]);
const matches = parseOutput.createTreeCursor().query(queries);
const ranges: string[] = [];

let match;
Expand Down

0 comments on commit 3d2dcdc

Please sign in to comment.