Skip to content
Myr

Fix benchmark output

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andrey Sitnik · committed by Andrey Sitnik · parent 00b3ac5 · Browse files · 1 file+9 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−9 removed

  • tests:+9 added−9 removed

1 file+9 added−9 removed

modified:test/benchmark+9 added-9 removed
33 unmodified lines
34 })35 .add('shortid', function () {36 shortid()37 })38 .add('uid', {38 .add('nanoid/async', {39 defer: true,40 fn: function (defer) {41 uid(14).then(function () {41 async().then(function () {42 defer.resolve()43 })44 }45 })46 .add('nanoid/async', {46 .add('uid', {47 defer: true,48 fn: function (defer) {49 async().then(function () {49 uid(14).then(function () {50 defer.resolve()51 })52 }53 })54 .add('rndm', function () {55 rndm(21)56 })54 .add('nanoid/non-secure', function () {55 nonSecure()56 })57 .add('rndm', function () {58 rndm(21)59 })60 .on('cycle', function (event) {61 var name = event.target.name.padEnd('nanoid/non-secure'.length)62 var hz = formatNumber(event.target.hz.toFixed(0)).padStart(9)63 if (event.target.name === 'uid') {63 if (event.target.name === 'nanoid/async') {64 name = '\nAsync:\n' + name65 } else if (event.target.name === 'rndm') {65 } else if (event.target.name === 'nanoid/non-secure') {66 name = '\nNon-secure:\n' + name67 }68 process.stdout.write(name + ' ' + chalk.bold(hz) + ' ops/sec\n')69 })
1 unmodified line