1'use strict'; 2const common = require('../common.js'); 3const StringDecoder = require('string_decoder').StringDecoder; 4 5const bench = common.createBenchmark(main, { 6 encoding: [ 7 'ascii', 'utf8', 'utf-8', 'base64', 'ucs2', 'UTF-8', 'AscII', 'UTF-16LE', 8 ], 9 n: [25e6] 10}); 11 12function main({ encoding, n }) { 13 bench.start(); 14 for (let i = 0; i < n; ++i) { 15 new StringDecoder(encoding); 16 } 17 bench.end(n); 18} 19