Skip to content
Myr

Speed up non-secure generator

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 99cfa4a · Browse files · 3 files+11 added−20 removed
This commit

State

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

Diff stats

3 files+11 added−20 removed

  • tests:+3 added−3 removed
  • other:+8 added−17 removed

3 files+11 added−20 removed

modified:test/benchmark+3 added-3 removed
32 unmodified lines
33 })34 .add('shortid', function () {35 shortid()36 })37 .add('nanoid/non-secure', function () {38 nonSecure()39 })37 .add('rndm', function () {38 rndm(21)39 })40 .add('nanoid/non-secure', function () {41 nonSecure()42 })43 .on('cycle', function (event) {44 var name = event.target.name.padEnd('nanoid/non-secure'.length)45 var hz = formatNumber(event.target.hz.toFixed(0)).padStart(9)46 process.stdout.write(name + ' ' + chalk.bold(hz) + ' ops/sec\n')
2 unmodified lines
modified:non-secure.js+1 added-10 removed
modified:README.md+7 added-7 removed
78 unmodified lines
79## Benchmark8081```82$ ./test/benchmark83nanoid 353,737 ops/sec84nanoid/generate 348,442 ops/sec85uid.sync 325,680 ops/sec86uuid/v4 350,075 ops/sec87shortid 85,107 ops/sec88rndm 2,390,814 ops/sec89nanoid/non-secure 2,043,665 ops/sec83nanoid 363,539 ops/sec84nanoid/generate 352,418 ops/sec85uid.sync 332,502 ops/sec86uuid/v4 345,867 ops/sec87shortid 34,193 ops/sec88rndm 2,557,778 ops/sec89nanoid/non-secure 2,578,934 ops/sec90```919293## Usage
125 unmodified lines