Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fluents/bench-chain
benchmark recording - averages & graphs.
https://github.com/fluents/bench-chain
Last synced: about 2 months ago
JSON representation
benchmark recording - averages & graphs.
- Host: GitHub
- URL: https://github.com/fluents/bench-chain
- Owner: fluents
- Created: 2017-04-24T20:53:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-05-10T10:03:19.000Z (over 7 years ago)
- Last Synced: 2024-10-04T09:13:41.539Z (2 months ago)
- Language: JavaScript
- Size: 67.4 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-fluents - bench-chain - averages & graphs. -- *Maintainer*: `James`[![Github](https://rawgit.com/d3viant0ne/awesome-webpack/master/media/github-square.svg)](https://github.com/aretecode)[![Twitter](https://rawgit.com/d3viant0ne/awesome-webpack/master/media/twitter-square.svg)](https://twitter.com/aretecode) (My Fluent Packages)
README
# 🏋️⛓ bench-chain
> chainable benchmark recording - averages & graphs.
[![Build Status][travis-image]][travis-url]
[![NPM version][bench-chain-npm-image]][bench-chain-npm-url]
[![MIT License][license-image]][license-url]
[![bench-chain][gitter-badge]][gitter-url]
[![Dependencies][david-deps-img]][david-deps-url]
[![fluents][fluents-image]][fluents-url][fluents-image]: https://img.shields.io/badge/⛓-fluent-9659F7.svg
[fluents-url]: https://www.npmjs.com/package/flipchain[bench-chain-npm-image]: https://img.shields.io/npm/v/bench-chain.svg
[bench-chain-npm-url]: https://npmjs.org/package/bench-chain
[license-image]: http://img.shields.io/badge/license-mit-blue.svg?style=flat
[license-url]: https://spdx.org/licenses/mit
[gitter-badge]: https://img.shields.io/gitter/room/bench-chain/pink.svg
[gitter-url]: https://gitter.im/bench-chain/Lobby[travis-image]: https://travis-ci.org/fluents/bench-chain.svg?branch=master
[travis-url]: https://travis-ci.org/fluents/bench-chain[david-deps-img]: https://david-dm.org/bench-chain/bench-chain.svg
[david-deps-url]: https://david-dm.org/bench-chain/bench-chainextension of [benchmark.js](https://benchmarkjs.com/)
## 📦 install
```bash
yarn add bench-chain
npm i bench-chain --save
``````js
const Bench = require('bench-chain')
```## [🌐 documentation](./docs)
## [🔬 tests](./tests)
## [📘 examples](./examples)### 👋 basic
```js
const Bench = require('bench-chain')Bench
// location to store benchmarks
.init(__dirname, 'basic.json')
// tag current benchmarks with, to mark what changes caused differences
.tags('v1')
// actual benchmarks
.add('1 * 1', () => 1 * 1)
.add('1 + 1', () => 1 + 1)
.run()
```### 💍 async
```js
const Bench = require('bench-chain')const sleep = sleepDuration => new Promise(resolve => setTimeout(resolve, sleepDuration))
Bench
.init().dir(__dirname).filename('asyncs.json').setup()
.name('sleepy')
.tags('v1,v2')// can also use .add, and then .runAsync()
.addAsync('sleep1', async done => {
await sleep(1000)
done()
})
.addAsync('sleep2', async done => {
await sleep(2000)
done()
})
.run()
```### 🚩 flags
[using funwithflags](https://github.com/aretecode/funwithflags)
* `--graph` will show only the graph reporting, rather than run the benchmarks
* `--run-times=10` will run the test `10` times### 📇 metadata
🔋 battery parsing when available
- will be used for comparing more benchmark results with averages
- amperage (number)
- currentCapacity (number)
- percent (number)
- charging (boolean)
- temp (number)- **mem**: operating system memory, nodejs memory
- **num**: operations a second from benchmarkjs hertz
- **sampled**: total runs samples from benchmarkjs
- **variation**: variation from benchmarkjs
- **timesFor**: microtime | performance.now times for beginning & end of each run
- **now**: Date.now for changes over time### graphs for trends and variation
### grouped by tags
### progress bars
![digress progress](https://cloud.githubusercontent.com/assets/4022631/25579989/ac2dc194-2e31-11e7-832b-75fa16b241e3.gif)