Fix tool name in benchmark
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 140d2df · Browse files · 5 files·+18 added−18 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
5 files+18 added−18 removed
- tests:+5 added−5 removed
- other:+13 added−13 removed
Provenance
- Commit
c332c1d- Tree
4c85a67- Author
Andrey Sitnik <andrey@sitnik.ru>- Committer
Andrey Sitnik <andrey@sitnik.ru>- Parent
140d2df
5 files changed+18 added−18 removed
modified:test/benchmark.js+5 added-5 removed
1234567891011111213141521 unmodified lines37383940414241424344454626 unmodified lines737475767777787980808182838417 unmodified lines#!/usr/bin/env node
let { v4: uuid4 } = require('uuid')let benchmark = require('benchmark')let shortid = require('shortid')let uidSafe = require('uid-safe')let crypto = require('crypto')let pico = require('picocolors')let cuid = require('cuid')let rndm = require('rndm')let srs = require('secure-random-string')let uid = require('uid-safe')
let { nanoid: aNanoid, customAlphabet: aCustomAlphabet } = require('../async')let { nanoid, customAlphabet } = require('../')let { nanoid: nonSecure } = require('../non-secure')21 unmodified lines }) .add('crypto.randomUUID', () => { crypto.randomUUID({ disableEntropyCache: true }) }) .add('uid.sync', () => { uid.sync(14) .add('uid-safe.sync', () => { uidSafe.sync(14) }) .add('secure-random-string', () => { srs() })26 unmodified lines defer.resolve() }) } }) .add('uid', { .add('uid-safe', { defer: true, fn(defer) { uid(14).then(() => { uidSafe(14).then(() => { defer.resolve() }) } })17 unmodified linesmodified:index.js+1 added-1 removed
5 unmodified lines678910101112131468 unmodified lines5 unmodified lines// avoid system call overhead. So, random numbers are generated in a// pool. The pool is a Buffer that is larger than the initial random// request size by this multiplier. The pool is enlarged if subsequent// requests exceed the maximum buffer size.const POOL_SIZE_MULTIPLIER = 32const POOL_SIZE_MULTIPLIER = 128let pool, poolOffset
let fillPool = bytes => { if (!pool || pool.length < bytes) {68 unmodified linesmodified:README.md+2 added-2 removed
84 unmodified lines85 nanoid 4,975,393 ops/sec86 customAlphabet 2,717,877 ops/sec87 uuid v4 1,778,339 ops/sec88 crypto.randomUUID 598,226 ops/sec89-uid.sync 391,311 ops/sec89+uid-safe.sync 391,311 ops/sec90 secure-random-string 372,537 ops/sec91 cuid 201,645 ops/sec92 shortid 50,462 ops/sec93 94 Async:95 async nanoid 95,500 ops/sec96 async customAlphabet 93,800 ops/sec97 async secure-random-string 90,316 ops/sec98-uid 85,583 ops/sec98+uid-safe 85,583 ops/sec99 100 Non-secure:101 non-secure nanoid 2,641,654 ops/sec102 rndm 2,447,086 ops/sec420 unmodified linesmodified:README.ru.md+2 added-2 removed
90 unmodified lines91 nanoid 4,975,393 ops/sec92 customAlphabet 2,717,877 ops/sec93 uuid v4 1,778,339 ops/sec94 crypto.randomUUID 598,226 ops/sec95-uid.sync 391,311 ops/sec95+uid-safe.sync 391,311 ops/sec96 secure-random-string 372,537 ops/sec97 cuid 201,645 ops/sec98 shortid 50,462 ops/sec99 100 Async:101 async nanoid 95,500 ops/sec102 async customAlphabet 93,800 ops/sec103 async secure-random-string 90,316 ops/sec104-uid 85,583 ops/sec104+uid-safe 85,583 ops/sec105 106 Non-secure:107 non-secure nanoid 2,641,654 ops/sec108 rndm 2,447,086 ops/sec406 unmodified linesmodified:README.zh-CN.md+8 added-8 removed
80 unmodified lines81 ## 基准值82 83 ```rust84 $ node ./test/benchmark.js85-nanoid 2,280,683 ops/sec86-customAlphabet 1,851,117 ops/sec87-uuid v4 1,348,425 ops/sec85+nanoid 4,975,393 ops/sec86+customAlphabet 2,717,877 ops/sec87+uuid v4 1,778,339 ops/sec88 crypto.randomUUID 598,226 ops/sec89-uid.sync 313,306 ops/sec90-secure-random-string 294,161 ops/sec91-cuid 158,988 ops/sec92-shortid 37,222 ops/sec89+uid-safe.sync 391,311 ops/sec90+secure-random-string 372,537 ops/sec91+cuid 201,645 ops/sec92+shortid 50,462 ops/sec93 94 Async:95 async nanoid 95,500 ops/sec96 async customAlphabet 93,800 ops/sec97 async secure-random-string 90,316 ops/sec98-uid 85,583 ops/sec98+uid-safe 85,583 ops/sec99 100 Non-secure:101 non-secure nanoid 2,641,654 ops/sec102 rndm 2,447,086 ops/sec409 unmodified lines