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

Conversation

woss
Copy link
Contributor

@woss woss commented Apr 13, 2024

  • Add fastest and slowest to benchmarks
  • upgrade packages
  • improve actions CI workflow

@woss
Copy link
Contributor Author

woss commented Apr 13, 2024

this PR includes the formatting of benchmarks js file and package.json natural sorting

Copy link
Owner

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please restore the old linting

@woss woss force-pushed the woss-improve-benchmarks branch from b78a7bb to e3e6e01 Compare April 13, 2024 15:34
@woss
Copy link
Contributor Author

woss commented Apr 13, 2024

@mcollina done

@woss woss force-pushed the woss-improve-benchmarks branch from e3e6e01 to 15ab5d2 Compare April 13, 2024 15:40
@woss
Copy link
Contributor Author

woss commented Apr 13, 2024

i'm not going to change the benchmarks in the README.md since I have a better machine than what's tested on.
here are my measurements

time node benchmark.js
crypto.randomUUID x 25,506,688 ops/sec ±0.85% (95 runs sampled)
hashids process.hrtime x 630,074 ops/sec ±0.84% (94 runs sampled)
hashids counter x 1,311,605 ops/sec ±1.11% (91 runs sampled)
shortid x 81,789 ops/sec ±1.88% (90 runs sampled)
crypto.random x 680,411 ops/sec ±1.49% (92 runs sampled)
nid x 1,342,997 ops/sec ±0.34% (95 runs sampled)
uuid.v4 x 2,464,305 ops/sec ±0.48% (95 runs sampled)
napiRsUuid.v4 x 6,052,699 ops/sec ±1.16% (98 runs sampled)
uuid.v1 x 3,320,904 ops/sec ±0.65% (98 runs sampled)
nanoid x 5,712,351 ops/sec ±6.12% (88 runs sampled)
hyperid - variable length x 38,822,129 ops/sec ±1.28% (91 runs sampled)
hyperid - fixed length x 39,178,669 ops/sec ±0.43% (99 runs sampled)
hyperid - fixed length, url safe x 39,907,360 ops/sec ±0.74% (94 runs sampled)


Fastest is hyperid - fixed length, url safe
Slowest is shortid
user=70.17s system=1.29s cpu=92% total=1:17.66

@woss woss requested a review from mcollina April 13, 2024 15:40
Copy link
Owner

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@woss
Copy link
Contributor Author

woss commented Apr 13, 2024

@mcollina i see that CI is failing. node 15 with standard.js issue. it would be good to have a recommit hook

- Add fastest and slowest to benchmarks
- upgrade packages
@woss woss force-pushed the woss-improve-benchmarks branch from 15ab5d2 to 368ff0a Compare April 13, 2024 17:41
@mcollina
Copy link
Owner

Can you please update gha workflow so that all tests pass?

Yopu can copy the logic from:
https://github.com/mcollina/fastq/blob/master/.github/workflows/ci.yml

@woss
Copy link
Contributor Author

woss commented Apr 22, 2024

@mcollina i've updated the ci.yaml. it seems that nullish coalescing operator is added in 14 + based on https://stackoverflow.com/a/68692190/2764898

I tested legacy command on 13 and it works whereas the normal test fails. the last commit should work.

Copy link
Owner

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Owner

the legacy script is missing.

@woss
Copy link
Contributor Author

woss commented Apr 24, 2024

damn it, i was 100% sure i committed the package.json. must have been tired.
image

@woss woss force-pushed the woss-improve-benchmarks branch from 0942b16 to e21ec3c Compare April 24, 2024 18:10
@mcollina
Copy link
Owner

Can you remove 0.10, 0.12 and 4, those were never supported here

@woss woss force-pushed the woss-improve-benchmarks branch from e21ec3c to a0af68d Compare April 25, 2024 07:20
Copy link
Owner

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 73db9cf into mcollina:master Apr 29, 2024
10 checks passed
@woss woss deleted the woss-improve-benchmarks branch April 29, 2024 13:11
@woss
Copy link
Contributor Author

woss commented Apr 30, 2024

@mcollina please don't forget to update the README with the benchmarks ran on your hardware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants