1'use strict'; 2 3const common = require('../common.js'); 4 5const bench = common.createBenchmark(main, { 6 encoding: [ 7 'ascii', 8 'base64', 9 'BASE64', 10 'binary', 11 'hex', 12 'HEX', 13 'latin1', 14 'LATIN1', 15 'UCS-2', 16 'UCS2', 17 'utf-16le', 18 'UTF-16LE', 19 'utf-8', 20 'utf16le', 21 'UTF16LE', 22 'utf8', 23 'UTF8', 24 ], 25 n: [1e6], 26}, { 27 flags: ['--expose-internals'], 28}); 29 30function main({ encoding, n }) { 31 const { normalizeEncoding } = require('internal/util'); 32 33 bench.start(); 34 for (let i = 0; i < n; i++) { 35 normalizeEncoding(encoding); 36 } 37 bench.end(n); 38} 39