diff options
Diffstat (limited to 'deps/node/benchmark/util/format.js')
-rw-r--r-- | deps/node/benchmark/util/format.js | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/deps/node/benchmark/util/format.js b/deps/node/benchmark/util/format.js deleted file mode 100644 index 2a4a2009..00000000 --- a/deps/node/benchmark/util/format.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -const util = require('util'); -const common = require('../common'); - -const inputs = { - 'string': ['Hello, my name is %s', 'Fred'], - 'string-2': ['Hello, %s is my name', 'Fred'], - 'number': ['Hi, I was born in %d', 1989], - 'replace-object': ['An error occurred %j', { msg: 'This is an error' }], - 'unknown': ['hello %a', 'test'], - 'no-replace': [1, 2], - 'no-replace-2': ['foobar', 'yeah', 'mensch', 5], - 'only-objects': [{ msg: 'This is an error' }, { msg: 'This is an error' }], - 'many-%': ['replace%%%%s%%%%many%s%s%s', 'percent'], -}; - -const bench = common.createBenchmark(main, { - n: [1e5], - type: Object.keys(inputs) -}); - -function main({ n, type }) { - // For testing, if supplied with an empty type, default to string. - const [first, second] = inputs[type || 'string']; - - bench.start(); - for (var i = 0; i < n; i++) { - util.format(first, second); - } - bench.end(n); -} |