Update benchmark (#584)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Andrey Sitnik · committed by GitHub · parent d3030b7 · Browse files · 10 files·+91 added−113 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
10 files+91 added−113 removed
- tests:+0 added−4 removed
- other:+91 added−109 removed
Provenance
- Commit
e646618- Tree
263d1a1- Author
Andrey Sitnik <andrey@sitnik.ru>- Committer
GitHub <noreply@github.com>- Parent
d3030b7
10 files changed+91 added−113 removed
modified:test/benchmark.js-4 removed
4 unmodified lines56789910111237 unmodified lines505152535556575455565727 unmodified lines4 unmodified linesimport crypto from 'node:crypto'import { styleText } from 'node:util'import rndm from 'rndm'import srs from 'secure-random-string'import shortid from 'shortid'import { Bench } from 'tinybench'import { uid } from 'uid'import uidSafe from 'uid-safe'import { uid as uidSecure } from 'uid/secure'37 unmodified lines }) .add('uid-safe.sync', () => { uidSafe.sync(14) }) .add('shortid', () => { shortid() }) .add('uid', () => { uid(32) }) .add('nanoid/non-secure', () => {27 unmodified linesmodified:package.json-1 removed
63 unmodified lines64 "oxlint": "^1.59.0",65 "oxlint-tsgolint": "^0.20.0",66 "rndm": "^1.2.0",67 "secure-random-string": "^1.1.4",68- "shortid": "^2.2.17",68 "simple-git-hooks": "^2.13.1",69 "size-limit": "^12.0.1",70 "terser": "^5.46.1",71 "tinybench": "^6.0.0",55 unmodified linesmodified:pnpm-lock.yaml-10 removed
48 unmodified lines49 version: 1.2.050 secure-random-string:51 specifier: ^1.1.452 version: 1.1.453- shortid:54- specifier: ^2.2.1755- version: 2.2.1753 simple-git-hooks:54 specifier: ^2.13.155 version: 2.13.156 size-limit:938 unmodified lines995 resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==}996 engines: {node: '>=10'}997 hasBin: true998 1002- shortid@2.2.17:1003- resolution: {integrity: sha512-GpbM3gLF1UUXZvQw6MCyulHkWbRseNO4cyBEZresZRorwl1+SLu1ZdqgVtuwqz8mB6RpwPkm541mYSqrKyJSaA==}1004-999 simple-git-hooks@2.13.1:1000 resolution: {integrity: sha512-WszCLXwT4h2k1ufIXAgsbiTOazqqevFCIncOuUBZJ91DdvWcC5+OFkluWRQPrcuSYd8fjq+o2y1QfWqYMoAToQ==}1001 hasBin: true1002 933 unmodified lines1936 semver@6.3.1: {}1937 1938 semver@7.7.4: {}1939 1946- shortid@2.2.17:1947- dependencies:1948- nanoid: 3.3.111949-1940 simple-git-hooks@2.13.1: {}1941 1942 size-limit@12.0.1(jiti@2.5.1):1943 dependencies:130 unmodified linesmodified:README.ar.md+13 added-14 removed
84 unmodified lines85 </div>86 87 ```rust88 $ node ./test/benchmark.js89-crypto.randomUUID 7,619,041 ops/sec90-uuid v4 7,436,626 ops/sec91-@napi-rs/uuid 4,730,614 ops/sec92-uid/secure 4,729,185 ops/sec93-@lukeed/uuid 4,015,673 ops/sec94-nanoid 3,693,964 ops/sec95-customAlphabet 2,799,255 ops/sec96-nanoid for browser 380,915 ops/sec97-secure-random-string 362,316 ops/sec98-uid-safe.sync 354,234 ops/sec99-shortid 38,808 ops/sec89+crypto.randomUUID 21,741,317 ops/sec90+uuid v4 21,204,378 ops/sec91+@napi-rs/uuid 10,236,615 ops/sec92+uid/secure 10,567,676 ops/sec93+@lukeed/uuid 8,647,481 ops/sec94+nanoid 7,800,308 ops/sec95+customAlphabet 9,697,350 ops/sec96+nanoid for browser 576,759 ops/sec97+secure-random-string 529,253 ops/sec98+uid-safe.sync 526,459 ops/sec99 100 Non-secure:102-uid 11,872,105 ops/sec103-nanoid/non-secure 2,226,483 ops/sec104-rndm 2,308,044 ops/sec101+uid 31,379,525 ops/sec102+nanoid/non-secure 3,678,505 ops/sec103+rndm 3,767,185 ops/sec104 ```105 106 <div dir="rtl">107 479 unmodified linesmodified:README.id-ID.md+13 added-14 removed
62 unmodified lines63 ## Benchmark64 65 ```rust66 $ node ./test/benchmark.js67-crypto.randomUUID 7,619,041 ops/sec68-uuid v4 7,436,626 ops/sec69-@napi-rs/uuid 4,730,614 ops/sec70-uid/secure 4,729,185 ops/sec71-@lukeed/uuid 4,015,673 ops/sec72-nanoid 3,693,964 ops/sec73-customAlphabet 2,799,255 ops/sec74-nanoid for browser 380,915 ops/sec75-secure-random-string 362,316 ops/sec76-uid-safe.sync 354,234 ops/sec77-shortid 38,808 ops/sec67+crypto.randomUUID 21,741,317 ops/sec68+uuid v4 21,204,378 ops/sec69+@napi-rs/uuid 10,236,615 ops/sec70+uid/secure 10,567,676 ops/sec71+@lukeed/uuid 8,647,481 ops/sec72+nanoid 7,800,308 ops/sec73+customAlphabet 9,697,350 ops/sec74+nanoid for browser 576,759 ops/sec75+secure-random-string 529,253 ops/sec76+uid-safe.sync 526,459 ops/sec77 78 Non-secure:80-uid 11,872,105 ops/sec81-nanoid/non-secure 2,226,483 ops/sec82-rndm 2,308,044 ops/sec79+uid 31,379,525 ops/sec80+nanoid/non-secure 3,678,505 ops/sec81+rndm 3,767,185 ops/sec82 ```83 84 Konfigurasi pengujian: Framework 13 7840U, Fedora 39, Node.js 21.6.85 258 unmodified linesmodified:README.ja.md+13 added-14 removed
75 unmodified lines76 ## ベンチマーク77 78 ```rust79 $ node ./test/benchmark.js80-crypto.randomUUID 7,619,041 ops/sec81-uuid v4 7,436,626 ops/sec82-@napi-rs/uuid 4,730,614 ops/sec83-uid/secure 4,729,185 ops/sec84-@lukeed/uuid 4,015,673 ops/sec85-nanoid 3,693,964 ops/sec86-customAlphabet 2,799,255 ops/sec87-nanoid for browser 380,915 ops/sec88-secure-random-string 362,316 ops/sec89-uid-safe.sync 354,234 ops/sec90-shortid 38,808 ops/sec80+crypto.randomUUID 21,741,317 ops/sec81+uuid v4 21,204,378 ops/sec82+@napi-rs/uuid 10,236,615 ops/sec83+uid/secure 10,567,676 ops/sec84+@lukeed/uuid 8,647,481 ops/sec85+nanoid 7,800,308 ops/sec86+customAlphabet 9,697,350 ops/sec87+nanoid for browser 576,759 ops/sec88+secure-random-string 529,253 ops/sec89+uid-safe.sync 526,459 ops/sec90 91 Non-secure:93-uid 11,872,105 ops/sec94-nanoid/non-secure 2,226,483 ops/sec95-rndm 2,308,044 ops/sec92+uid 31,379,525 ops/sec93+nanoid/non-secure 3,678,505 ops/sec94+rndm 3,767,185 ops/sec95 ```96 97 テスト構成:Framework 13 7840U, Fedora 39, Node.js 21.6.98 365 unmodified linesmodified:README.ko.md+13 added-14 removed
74 unmodified lines75 ## 벤치마크76 77 ```rust78 $ node ./test/benchmark.js79-crypto.randomUUID 7,619,041 ops/sec80-uuid v4 7,436,626 ops/sec81-@napi-rs/uuid 4,730,614 ops/sec82-uid/secure 4,729,185 ops/sec83-@lukeed/uuid 4,015,673 ops/sec84-nanoid 3,693,964 ops/sec85-customAlphabet 2,799,255 ops/sec86-nanoid for browser 380,915 ops/sec87-secure-random-string 362,316 ops/sec88-uid-safe.sync 354,234 ops/sec89-shortid 38,808 ops/sec79+crypto.randomUUID 21,741,317 ops/sec80+uuid v4 21,204,378 ops/sec81+@napi-rs/uuid 10,236,615 ops/sec82+uid/secure 10,567,676 ops/sec83+@lukeed/uuid 8,647,481 ops/sec84+nanoid 7,800,308 ops/sec85+customAlphabet 9,697,350 ops/sec86+nanoid for browser 576,759 ops/sec87+secure-random-string 529,253 ops/sec88+uid-safe.sync 526,459 ops/sec89 90 Non-secure:92-uid 11,872,105 ops/sec93-nanoid/non-secure 2,226,483 ops/sec94-rndm 2,308,044 ops/sec91+uid 31,379,525 ops/sec92+nanoid/non-secure 3,678,505 ops/sec93+rndm 3,767,185 ops/sec94 ```95 96 테스트 환경: 프레임워크 13 7840U, 페도라 39, Node.js 21.6.97 370 unmodified linesmodified:README.md+13 added-14 removed
76 unmodified lines77 ## Benchmark78 79 ```rust80 $ node ./test/benchmark.js81-crypto.randomUUID 7,619,041 ops/sec82-uuid v4 7,436,626 ops/sec83-@napi-rs/uuid 4,730,614 ops/sec84-uid/secure 4,729,185 ops/sec85-@lukeed/uuid 4,015,673 ops/sec86-nanoid 3,693,964 ops/sec87-customAlphabet 2,799,255 ops/sec88-nanoid for browser 380,915 ops/sec89-secure-random-string 362,316 ops/sec90-uid-safe.sync 354,234 ops/sec91-shortid 38,808 ops/sec81+crypto.randomUUID 21,741,317 ops/sec82+uuid v4 21,204,378 ops/sec83+@napi-rs/uuid 10,236,615 ops/sec84+uid/secure 10,567,676 ops/sec85+@lukeed/uuid 8,647,481 ops/sec86+nanoid 7,800,308 ops/sec87+customAlphabet 9,697,350 ops/sec88+nanoid for browser 576,759 ops/sec89+secure-random-string 529,253 ops/sec90+uid-safe.sync 526,459 ops/sec91 92 Non-secure:94-uid 11,872,105 ops/sec95-nanoid/non-secure 2,226,483 ops/sec96-rndm 2,308,044 ops/sec93+uid 31,379,525 ops/sec94+nanoid/non-secure 3,678,505 ops/sec95+rndm 3,767,185 ops/sec96 ```97 98 Test configuration: Framework 13 7840U, Fedora 39, Node.js 21.6.99 384 unmodified linesmodified:README.ru.md+13 added-14 removed
81 unmodified lines82 ## Сравнение производительности83 84 ```rust85 $ node ./test/benchmark.js86-crypto.randomUUID 7,619,041 ops/sec87-uuid v4 7,436,626 ops/sec88-@napi-rs/uuid 4,730,614 ops/sec89-uid/secure 4,729,185 ops/sec90-@lukeed/uuid 4,015,673 ops/sec91-nanoid 3,693,964 ops/sec92-customAlphabet 2,799,255 ops/sec93-nanoid for browser 380,915 ops/sec94-secure-random-string 362,316 ops/sec95-uid-safe.sync 354,234 ops/sec96-shortid 38,808 ops/sec86+crypto.randomUUID 21,741,317 ops/sec87+uuid v4 21,204,378 ops/sec88+@napi-rs/uuid 10,236,615 ops/sec89+uid/secure 10,567,676 ops/sec90+@lukeed/uuid 8,647,481 ops/sec91+nanoid 7,800,308 ops/sec92+customAlphabet 9,697,350 ops/sec93+nanoid for browser 576,759 ops/sec94+secure-random-string 529,253 ops/sec95+uid-safe.sync 526,459 ops/sec96 97 Non-secure:99-uid 11,872,105 ops/sec100-nanoid/non-secure 2,226,483 ops/sec101-rndm 2,308,044 ops/sec98+uid 31,379,525 ops/sec99+nanoid/non-secure 3,678,505 ops/sec100+rndm 3,767,185 ops/sec101 ```102 103 Среда сравнения: Framework 13 7840U, Fedora 39, Node.js 21.6.104 359 unmodified linesmodified:README.zh-CN.md+13 added-14 removed
69 unmodified lines70 ## 基准值71 72 ```rust73 $ node ./test/benchmark.js74-crypto.randomUUID 7,619,041 ops/sec75-uuid v4 7,436,626 ops/sec76-@napi-rs/uuid 4,730,614 ops/sec77-uid/secure 4,729,185 ops/sec78-@lukeed/uuid 4,015,673 ops/sec79-nanoid 3,693,964 ops/sec80-customAlphabet 2,799,255 ops/sec81-nanoid for browser 380,915 ops/sec82-secure-random-string 362,316 ops/sec83-uid-safe.sync 354,234 ops/sec84-shortid 38,808 ops/sec74+crypto.randomUUID 21,741,317 ops/sec75+uuid v4 21,204,378 ops/sec76+@napi-rs/uuid 10,236,615 ops/sec77+uid/secure 10,567,676 ops/sec78+@lukeed/uuid 8,647,481 ops/sec79+nanoid 7,800,308 ops/sec80+customAlphabet 9,697,350 ops/sec81+nanoid for browser 576,759 ops/sec82+secure-random-string 529,253 ops/sec83+uid-safe.sync 526,459 ops/sec84 85 Non-secure:87-uid 11,872,105 ops/sec88-nanoid/non-secure 2,226,483 ops/sec89-rndm 2,308,044 ops/sec86+uid 31,379,525 ops/sec87+nanoid/non-secure 3,678,505 ops/sec88+rndm 3,767,185 ops/sec89 ```90 91 测试配置: Framework 13 7840U, Fedora 39, Node.js 21.6.92 321 unmodified lines