From b20ca3cf516cf4a019ef6aff50e425dd11ea143c Mon Sep 17 00:00:00 2001 From: LongYinan Date: Wed, 12 Jan 2022 21:26:37 +0800 Subject: [PATCH] bench: add @napi-rs/uuid v4 --- package.json | 1 + pnpm-lock.yaml | 128 ++++++++++++++++++++++++++++++++++++++++++++++ test/benchmark.js | 4 ++ 3 files changed, 133 insertions(+) diff --git a/package.json b/package.json index bfe5ed67..094a7c9d 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@babel/core": "^7.16.7", "@logux/eslint-config": "^46.1.1", "@lukeed/uuid": "^2.0.0", + "@napi-rs/uuid": "^0.2.0", "@originjs/vite-plugin-commonjs": "^1.0.2", "@size-limit/dual-publish": "^7.0.5", "@size-limit/file": "^7.0.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 387c8a6e..3c15f921 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,7 @@ specifiers: '@babel/core': ^7.16.7 '@logux/eslint-config': ^46.1.1 '@lukeed/uuid': ^2.0.0 + '@napi-rs/uuid': ^0.2.0 '@originjs/vite-plugin-commonjs': ^1.0.2 '@size-limit/dual-publish': ^7.0.5 '@size-limit/file': ^7.0.5 @@ -41,6 +42,7 @@ devDependencies: '@babel/core': 7.16.7 '@logux/eslint-config': 46.1.1_d1222171c29616668e681fe85aa8127f '@lukeed/uuid': 2.0.0 + '@napi-rs/uuid': 0.2.0 '@originjs/vite-plugin-commonjs': 1.0.2 '@size-limit/dual-publish': 7.0.5_a47e5bdb67ef3d4d027dcc8e00619498 '@size-limit/file': 7.0.5_size-limit@7.0.5 @@ -343,6 +345,132 @@ packages: '@lukeed/csprng': 1.0.1 dev: true + /@napi-rs/uuid-android-arm-eabi/0.2.0: + resolution: {integrity: sha512-oXrdam4nPEAIbVarDgCjCgUcfS/zO1yPBJkrQmbww5VtWi4z5qpfXJIDkS9oKWHE0gnjNXsG4wDokdl7BpcrUA==} + engines: {node: '>= 10'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-android-arm64/0.2.0: + resolution: {integrity: sha512-UppZr5o/ZyNAhj5koB60UqGPKkvt/J6tzULhdXHzXl02+BC3WACu63vNBhxMYIaq6ptKzy98yXEUk+txaZkdIg==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-darwin-arm64/0.2.0: + resolution: {integrity: sha512-Zzflpi2y8ngiNplORAhRYt/aQeGBTa+n3AGz4NbkKsQH6+gB15/yaeJne1Q34yRmpveOyFffYjgdEvFiu7Kz4w==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-darwin-x64/0.2.0: + resolution: {integrity: sha512-S1JZZXL4bxN/CocZIxnHTYCgzxJK+ySFzWCqFLov7z1vAIFVwhP19otgkDIdoEEHGq5e9f09isLbynGZXx+EMw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-freebsd-x64/0.2.0: + resolution: {integrity: sha512-ovshM+VJ+XXEcmEu0UeLhKFLVL8+vzDyUKgMBJI+nj2ptDycypqsKsRKVfgL5QViKrU36h19wMxc2bu3R2tb0w==} + engines: {node: '>= 10'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-linux-arm-gnueabihf/0.2.0: + resolution: {integrity: sha512-tuHEN7UWAxJ0aVihbdb3GjehFebx4V/EHLJ8o+laXKZzGLd9RiajG4mkjkZwVEimvIBXpXsvuEWFqtnqzoKvnA==} + engines: {node: '>= 10'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-linux-arm64-gnu/0.2.0: + resolution: {integrity: sha512-ko1hT+OVBUnem49YoiyFoXQ6e6zmXPUscSMkg5IBDA70NzbDL11pGrVSGuIzz7Zzt4z+3bE0CI2EaRIZ92NW9g==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-linux-arm64-musl/0.2.0: + resolution: {integrity: sha512-r9KIhJz+hzcPulcdRCnioouZMdRPRnLy0dbfkYiw0mOkt9kfbVXpRzbt7xz8B/Zf/d5LEWZsIFJHbiKxuIfPSA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-linux-x64-gnu/0.2.0: + resolution: {integrity: sha512-iX+WBrBv5sjO690/zjuWvf7tt9/Jge+Qkrogh/es5u8+EMXSGTl9gW7PajL8pnNzDcdkVNgr41VrqmVGWzLFVw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-linux-x64-musl/0.2.0: + resolution: {integrity: sha512-ekDiT4iKKR8Vzop7JXxLpmRp4fHmGZYiOImN69DX+5nJUewwwLbIR7784qNBRUHJi7tzIhAM+5TfO3rmGTkmgw==} + engines: {node: '>= 10'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-win32-arm64-msvc/0.2.0: + resolution: {integrity: sha512-zgq38ZQazk8bijAosK3SgJcUxpp3u8UOkNbUswsXPjurb3tLcM9HP5e79ujaHsUogFdN87l7fh/kXzHNEvwEsA==} + engines: {node: '>= 10'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid-win32-x64-msvc/0.2.0: + resolution: {integrity: sha512-SJ79IKI6BpmRxixUHGhCjOZ8TwXv3pfJJ8WxQvbcU8HMrfv+lW4X8/iq3eZ8tCu6Pb6KxPh92B4FQ3XJnHL+GA==} + engines: {node: '>= 10'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@napi-rs/uuid/0.2.0: + resolution: {integrity: sha512-iwoDZeVB1W1dOkWvTTMIrDejySBF9hPgDUG/bJbKmLKruSCVjbJPFcDJtiRX6OD1qy7ObxtUrn8ofwcnRC/hJg==} + engines: {node: '>= 10'} + optionalDependencies: + '@napi-rs/uuid-android-arm-eabi': 0.2.0 + '@napi-rs/uuid-android-arm64': 0.2.0 + '@napi-rs/uuid-darwin-arm64': 0.2.0 + '@napi-rs/uuid-darwin-x64': 0.2.0 + '@napi-rs/uuid-freebsd-x64': 0.2.0 + '@napi-rs/uuid-linux-arm-gnueabihf': 0.2.0 + '@napi-rs/uuid-linux-arm64-gnu': 0.2.0 + '@napi-rs/uuid-linux-arm64-musl': 0.2.0 + '@napi-rs/uuid-linux-x64-gnu': 0.2.0 + '@napi-rs/uuid-linux-x64-musl': 0.2.0 + '@napi-rs/uuid-win32-arm64-msvc': 0.2.0 + '@napi-rs/uuid-win32-x64-msvc': 0.2.0 + dev: true + /@nodelib/fs.scandir/2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} diff --git a/test/benchmark.js b/test/benchmark.js index 9a89109f..5779bb54 100755 --- a/test/benchmark.js +++ b/test/benchmark.js @@ -2,6 +2,7 @@ let { uid: uidSecure } = require('uid/secure') let { v4: lukeed4 } = require('@lukeed/uuid') +let { v4: napiv4 } = require('@napi-rs/uuid') let { v4: uuid4 } = require('uuid') let benchmark = require('benchmark') let shortid = require('shortid') @@ -32,6 +33,9 @@ suite .add('crypto.randomUUID', () => { crypto.randomUUID() }) + .add('@napi-rs/uuid', () => { + napiv4() + }) .add('uid/secure', () => { uidSecure(32) })