Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fastest and slowest to benchmark #37

Merged
merged 2 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 44 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,54 @@
name: CI

on: [push, pull_request]

jobs:
test:
name: ${{ matrix.node-version }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
legacy:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
node-version: [6, 8, 10, 11, 12, 13, 14, 15]
node-version: [6.x, 8.x, 10.x, 12.x, 13.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: |
npm install --production && npm install tape

- name: Run tests
run: |
npm run legacy

test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x, 15.x, 16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v3
with:
persist-credentials: false

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install
run: npm i
- name: Tests
run: npm test
run: |
npm install

- name: Run tests
run: |
npm run test
8 changes: 7 additions & 1 deletion benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ suite.add('hyperid - fixed length, url safe', function () {

suite.on('cycle', cycle)

suite.run()
suite.on('complete', function () {
console.log('\n')
console.log(`Fastest is ${this.filter('fastest').map('name')}`)
console.log(`Slowest is ${this.filter('slowest').map('name')}`)
})

suite.run({ async: true })

function cycle (e) {
console.log(e.target.toString())
Expand Down
23 changes: 12 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
],
"scripts": {
"typescript": "tsc --project ./test/tsconfig.json",
"test": "standard && tape test/test.js test/uniqueness.js test/buffer.js | tap-dot && npm run typescript"
"test": "standard && tape test/test.js test/uniqueness.js test/buffer.js | tap-dot && npm run typescript",
"legacy": "tape test/test.js"
},
"repository": {
"type": "git",
Expand All @@ -30,24 +31,24 @@
},
"homepage": "https://github.com/mcollina/hyperid#readme",
"devDependencies": {
"@napi-rs/uuid": "^0.1.0",
"@napi-rs/uuid": "^0.2.0",
"benchmark": "^2.1.4",
"bloomfilter": "0.0.18",
"bloomfilter": "^0.0.18",
"hashids": "^2.2.8",
"nanoid": "^3.1.20",
"nid": "^1.1.0",
"nanoid": "^3.0.0",
"nid": "^2.0.1",
"pre-commit": "^1.2.2",
"shortid": "^2.2.15",
"standard": "^16.0.3",
"proxyquire": "^2.1.3",
"shortid": "^2.2.16",
"standard": "^17.1.0",
"tap-dot": "^2.0.0",
"tape": "^5.0.0",
"typescript": "^4.3.4",
"proxyquire": "^2.1.3"
"typescript": "^5.4.5"
},
"dependencies": {
"buffer": "^5.2.1",
"uuid": "^8.3.2",
"uuid-parse": "^1.1.0",
"buffer": "^5.2.1"
"uuid-parse": "^1.1.0"
},
"browser": {
"./uuid-node.js": "./uuid-browser.js"
Expand Down
Loading