Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yashladha/node-microbenchmark
Micro benchmarking library for Node.JS 🚀
https://github.com/yashladha/node-microbenchmark
benchmarking microbenchmark node
Last synced: 3 months ago
JSON representation
Micro benchmarking library for Node.JS 🚀
- Host: GitHub
- URL: https://github.com/yashladha/node-microbenchmark
- Owner: yashLadha
- License: mit
- Created: 2020-04-29T17:31:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-01-18T05:11:51.000Z (almost 3 years ago)
- Last Synced: 2023-02-28T09:52:17.740Z (almost 2 years ago)
- Topics: benchmarking, microbenchmark, node
- Language: JavaScript
- Homepage:
- Size: 86.9 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## node-microbenchmark
[![npm version](https://badge.fury.io/js/node-microbenchmark.svg)](https://badge.fury.io/js/node-microbenchmark)
A micro benchmarking library inspired from [google-benchmark](https://github.com/google/benchmark)
Features available:
* Benchmarking synchronous functions
* Benchmarking of asynchronous functions
* Support for Promises
* High precision benchmark (upto nanoseconds precision)### Benchmarking of synchronous functions
```javascript
const { benchmark, show } = require('node-microbenchmark');const slowFn = () => {
for (var i = 0; i < 1e4; ++i);
}const fastFn = () => {}
benchmark(slowFn);
benchmark(fastFn);show();
```### Benchmarking of asynchronous functions
```javascript
const benchmark = require('../index');const slowTimer = () => new Promise(res => setTimeout(res, 200));
const fastTimer = () => new Promise(res => setTimeout(res, 50));const fn = async () => {
await benchmark.benchmarkPromise(slowTimer);
await benchmark.benchmarkPromise(fastTimer);
benchmark.show();
};fn();
```![node-microbenchmark](https://raw.githubusercontent.com/yashladha/node-microbenchmark/master/images/node-microbenchmark.png)
## Future enhancements
* Benchmark async code like promises.
## Author
* [yashLadha](https://github.com/yashLadha)