https://github.com/paulmillr/micro-bmark
Benchmark your node.js projects with nanosecond resolution.
https://github.com/paulmillr/micro-bmark
bechmark bench nanosecond node nodejs resolution
Last synced: 9 months ago
JSON representation
Benchmark your node.js projects with nanosecond resolution.
- Host: GitHub
- URL: https://github.com/paulmillr/micro-bmark
- Owner: paulmillr
- License: mit
- Created: 2020-03-29T12:18:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2025-04-21T17:30:49.000Z (about 1 year ago)
- Last Synced: 2025-04-21T17:47:06.146Z (about 1 year ago)
- Topics: bechmark, bench, nanosecond, node, nodejs, resolution
- Language: JavaScript
- Homepage: https://paulmillr.com
- Size: 57.6 KB
- Stars: 34
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/funding.yml
- License: LICENSE
Awesome Lists containing this project
README
# micro-bmark
> [!WARNING]
> The package got merged into [paulmillr/jsbt](https://github.com/paulmillr/jsbt)
> and is now deprecated.
Benchmark your JS projects with nanosecond resolution.
- Precise: 1ns resolution using `process.hrtime`
- Lightweight: ~200 lines of code, no dependencies - to not interfere with benchmarked code
- Readable: utilizes colors and nice units, shows rel. margin of error only if it's high

## Usage
npm install --save-dev micro-bmark
```js
import bench from 'micro-bmark';
(async () => {
await bench('printing', () => Promise.resolve(0));
await bench('base', () => Promise.resolve(1));
await bench('sqrt', 10000, () => Math.sqrt(2));
})();
```
Example output:
```
getPublicKey x 6,072 ops/sec @ 164μs/op ± 8.22% [143μs..17ms]
sign x 4,980 ops/sec @ 200μs/op
verify x 969 ops/sec @ 1ms/op
recoverPublicKey x 890 ops/sec @ 1ms/op
getSharedSecret x 585 ops/sec @ 1ms/op
```
## License
MIT License
Copyright (c) 2020 Paul Miller (https://paulmillr.com), (c) 2010-2016 Mathias Bynens, John-David Dalton, (c) Robert Kieffer from JSLitmus.js