%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; const common = require('../common.js'); const fs = require('fs'); const path = require('path'); const searchStrings = [ '@', 'SQ', '--l', 'Alice', 'Gryphon', 'Ou est ma chatte?', 'found it very', 'neighbouring pool', 'aaaaaaaaaaaaaaaaa', 'venture to go near the house till she had brought herself down to', '</i> to the Caterpillar', ]; const bench = common.createBenchmark(main, { search: searchStrings, encoding: ['utf8', 'ucs2'], type: ['buffer', 'string'], n: [5e4] }); function main({ n, search, encoding, type }) { let aliceBuffer = fs.readFileSync( path.resolve(__dirname, '../fixtures/alice.html') ); if (encoding === 'undefined') { encoding = undefined; } if (encoding === 'ucs2') { aliceBuffer = Buffer.from(aliceBuffer.toString(), encoding); } if (type === 'buffer') { search = Buffer.from(Buffer.from(search).toString(), encoding); } bench.start(); for (let i = 0; i < n; i++) { aliceBuffer.indexOf(search, 0, encoding); } bench.end(n); }