11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common.js'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ciconst bench = common.createBenchmark(main, { 61cb0ef41Sopenharmony_ci encoding: [ 71cb0ef41Sopenharmony_ci 'ascii', 81cb0ef41Sopenharmony_ci 'base64', 91cb0ef41Sopenharmony_ci 'BASE64', 101cb0ef41Sopenharmony_ci 'binary', 111cb0ef41Sopenharmony_ci 'hex', 121cb0ef41Sopenharmony_ci 'HEX', 131cb0ef41Sopenharmony_ci 'latin1', 141cb0ef41Sopenharmony_ci 'LATIN1', 151cb0ef41Sopenharmony_ci 'UCS-2', 161cb0ef41Sopenharmony_ci 'UCS2', 171cb0ef41Sopenharmony_ci 'utf-16le', 181cb0ef41Sopenharmony_ci 'UTF-16LE', 191cb0ef41Sopenharmony_ci 'utf-8', 201cb0ef41Sopenharmony_ci 'utf16le', 211cb0ef41Sopenharmony_ci 'UTF16LE', 221cb0ef41Sopenharmony_ci 'utf8', 231cb0ef41Sopenharmony_ci 'UTF8', 241cb0ef41Sopenharmony_ci ], 251cb0ef41Sopenharmony_ci n: [1e6], 261cb0ef41Sopenharmony_ci}, { 271cb0ef41Sopenharmony_ci flags: ['--expose-internals'], 281cb0ef41Sopenharmony_ci}); 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_cifunction main({ encoding, n }) { 311cb0ef41Sopenharmony_ci const { normalizeEncoding } = require('internal/util'); 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ci bench.start(); 341cb0ef41Sopenharmony_ci for (let i = 0; i < n; i++) { 351cb0ef41Sopenharmony_ci normalizeEncoding(encoding); 361cb0ef41Sopenharmony_ci } 371cb0ef41Sopenharmony_ci bench.end(n); 381cb0ef41Sopenharmony_ci} 39