Skip to content

Commit cdf04bf

Browse files
committed
Version 2.0 release
1 parent 65ab012 commit cdf04bf

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

test/performance-test.spec.ts

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@ import chalk from 'chalk';
55

66
// Uncomment this for performance testing.
77

8-
describe.only('parse queries', () => {
9-
it('should run performance tests', async () => {
10-
const numIterations = 1000;
8+
// describe.only('parse queries', () => {
9+
// it('should run performance tests', async () => {
10+
// const numIterations = 1000;
1111

12-
console.log(chalk.whiteBright(`Importing SOQL Parser library.`));
12+
// console.log(chalk.whiteBright(`Importing SOQL Parser library.`));
1313

14-
const startImport = performance.now();
15-
const { parseQuery } = await import('../src');
16-
const endImport = performance.now();
17-
const importDuration = endImport - startImport;
14+
// const startImport = performance.now();
15+
// const { parseQuery } = await import('../src');
16+
// const endImport = performance.now();
17+
// const importDuration = endImport - startImport;
1818

19-
console.log(chalk.whiteBright(`Duration: ${chalk.greenBright(Number(importDuration).toFixed(4))} milliseconds`));
19+
// console.log(chalk.whiteBright(`Duration: ${chalk.greenBright(Number(importDuration).toFixed(4))} milliseconds`));
2020

21-
console.log(
22-
chalk.whiteBright(`Parser testing: ${testCases.length} X ${numIterations} = ${testCases.length * numIterations} iterations.`),
23-
);
24-
const start = performance.now();
25-
for (let i = 0; i < numIterations; i++) {
26-
testCases.forEach(testCase => {
27-
try {
28-
parseQuery(testCase.soql, { allowApexBindVariables: true, logErrors: true });
29-
} catch (ex) {
30-
console.log('Exception on TC', testCase.testCase, testCase.soql);
31-
console.log(ex);
32-
throw ex;
33-
}
34-
});
35-
}
36-
const end = performance.now();
37-
const duration = end - start;
38-
console.log(chalk.whiteBright(`Duration: ${chalk.greenBright(Number(duration / 1000).toFixed(4))} seconds`));
39-
console.log(
40-
chalk.whiteBright(
41-
`Average of ${chalk.greenBright(Number(duration / (testCases.length * numIterations)).toFixed(4))} milliseconds per query`,
42-
),
43-
);
44-
return;
45-
});
46-
});
21+
// console.log(
22+
// chalk.whiteBright(`Parser testing: ${testCases.length} X ${numIterations} = ${testCases.length * numIterations} iterations.`),
23+
// );
24+
// const start = performance.now();
25+
// for (let i = 0; i < numIterations; i++) {
26+
// testCases.forEach(testCase => {
27+
// try {
28+
// parseQuery(testCase.soql, { allowApexBindVariables: true, logErrors: true });
29+
// } catch (ex) {
30+
// console.log('Exception on TC', testCase.testCase, testCase.soql);
31+
// console.log(ex);
32+
// throw ex;
33+
// }
34+
// });
35+
// }
36+
// const end = performance.now();
37+
// const duration = end - start;
38+
// console.log(chalk.whiteBright(`Duration: ${chalk.greenBright(Number(duration / 1000).toFixed(4))} seconds`));
39+
// console.log(
40+
// chalk.whiteBright(
41+
// `Average of ${chalk.greenBright(Number(duration / (testCases.length * numIterations)).toFixed(4))} milliseconds per query`,
42+
// ),
43+
// );
44+
// return;
45+
// });
46+
// });

0 commit comments

Comments
 (0)