mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
492 B
23 lines
492 B
'use strict';
|
|
const common = require('../common.js');
|
|
const fs = require('fs');
|
|
const path = require('path');
|
|
|
|
const bench = common.createBenchmark(main, {
|
|
value: ['@'.charCodeAt(0)],
|
|
n: [1e7]
|
|
});
|
|
|
|
function main(conf) {
|
|
const n = +conf.n;
|
|
const search = +conf.value;
|
|
const aliceBuffer = fs.readFileSync(
|
|
path.resolve(__dirname, '../fixtures/alice.html')
|
|
);
|
|
|
|
bench.start();
|
|
for (var i = 0; i < n; i++) {
|
|
aliceBuffer.indexOf(search, 0, undefined);
|
|
}
|
|
bench.end(n);
|
|
}
|
|
|