# loopbench

> Benchmark your event loop

Latest version **2.0.0** (published 2022-03-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install loopbench
pnpm add loopbench
yarn add loopbench
bun add loopbench
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-03-24 |
| First published | 2015-11-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/loopbench) |
| Module format | CommonJS |
| Node | >=12.0.0 |
| Dependencies | 0 |
| Unpacked size | 9.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 112 |
| Author | Matteo Collina |
| Maintainers | matteo.collina, davidmarkclements |
| Keywords | benchmark, event, loop |

## Links

- npm: https://www.npmjs.com/package/loopbench
- Repository: https://github.com/mcollina/loopbench
- Homepage: https://github.com/mcollina/loopbench#readme
- Issues: https://github.com/mcollina/loopbench/issues
- npm.io page: https://npm.io/package/loopbench

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 2.0.0 (latest) — 2022-03-24
- 1.2.0 — 2016-02-03
- 1.1.0 — 2015-11-12
- 1.0.0 — 2015-11-10

## README

# loopbench

Benchmark your event loop, extracted from [hapi](http://npm.im/hapi),
[hoek](http://npm.im/hoek), [heavy](http://npm.im/heavy) and
[boom](http://npm.im/boom).

* [Install](#install)
* [Example](#example)
* [API](#api)
* [Acknowledgements](#acknowledgements)
* [License](#license)

<a name="install"></a>
## Install
To install loopbench, simply use npm:

```
npm i loopbench --save
```

<a name="example"></a>
## Example

See [example.js][example].

<a name="api"></a>
## API

  * <a href="#constructor"><code><b>loopbench()</b></code></a>
  * <a href="#delay"><code>instance.<b>delay</b></code></a>
  * <a href="#limit"><code>instance.<b>limit</b></code></a>
  * <a href="#overLimit"><code>instance.<b>overLimit</b></code></a>
  * <a href="#stop"><code>instance.<b>stop()</b></code></a>

-------------------------------------------------------
<a name="constructor"></a>
### loopbench([opts])

Creates a new instance of loopbench.

Options:

* `sampleInterval`: the interval at which the eventLoop should be
  sampled, defaults to `5`.
* `limit`: the maximum amount of delay that is tollerated before
  [`overLimit`](#overLimit) becomes true, and the `load` event is
  emitted, defaults to `42`.

Events:

* `load`, emitted when `instance.delay > instance.limit`
* `unload`, emitted when `overLimit` goes from `true` and `false`

-------------------------------------------------------
<a name="delay"></a>
### instance.delay

The delay in milliseconds (and fractions) from the expected run.
It might be negative (in older nodes).

-------------------------------------------------------
<a name="limit"></a>
### instance.limit

The maximum amount of delay that is tollerated before
[`overLimit`](#overlimit) becomes true, and the `load` event is
emitted.

-------------------------------------------------------
<a name="overLimit"></a>
### instance.overLimit

Is `true` if the `instance.delay > instance.limit`.

-------------------------------------------------------
<a name="stop"></a>
### instance.stop()

Stops the sampling.

<a name="license"></a>
## License

Copyright Matteo Collina 2015-2022, Licensed under [MIT][].

[MIT]: ./LICENSE
[example]: ./example.js

---
_Source: https://npm.io/package/loopbench · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
