Files
John 69b4e68baf
SAP-ERP Portal CI/CD / build (push) Failing after 5m20s
first commit
2026-09-23 17:31:02 +05:30

26 lines
583 B
JavaScript

const { createBenchmark } = require('../common');
const { Parser } = require('../../src/token/token-stream-parser');
const bench = createBenchmark(main, {
n: [10, 100, 1000],
tokenCount: [10, 100, 1000, 10000]
});
async function * repeat(data, n) {
for (let i = 0; i < n; i++) {
yield data;
}
}
function main({ n, tokenCount }) {
const data = Buffer.from('FE0000E0000000000000000000'.repeat(tokenCount), 'hex');
const parser = new Parser(repeat(data, n), { token: function() { } }, {}, {});
bench.start();
parser.on('end', () => {
bench.end(n);
});
}