# performance-fps

> Performance check tool for scalable quality project.

Latest version **1.2.10** (published 2019-07-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install performance-fps
pnpm add performance-fps
yarn add performance-fps
bun add performance-fps
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.10 |
| Published | 2019-07-15 |
| First published | 2018-06-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | William Manco |
| Maintainers | williammanco |
| Keywords | performance, fps, check, tool, scalable |

## Links

- npm: https://www.npmjs.com/package/performance-fps
- Repository: https://github.com/williammanco/performance-fps
- Homepage: https://github.com/williammanco/performance-fps#readme
- Issues: https://github.com/williammanco/performance-fps/issues
- npm.io page: https://npm.io/package/performance-fps

## Dependencies (1)

- [gl-toy](https://npm.io/package/gl-toy.md) ^2.0.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.2.10 (latest) — 2019-07-15
- 1.2.8 — 2018-09-02
- 1.2.7 — 2018-09-02
- 1.2.4 — 2018-09-01
- 1.2.3 — 2018-09-01
- 1.2.1 — 2018-09-01
- 1.1.0 — 2018-06-18

## README

# Performance FPS

⭐️⁉️ [New version here (fast, small and functional)](https://github.com/williammanco/check-performance)

Performance check tool for **scalable** quality project.
Use this tool to check current state of performance based on fps/ms of project during navigation.

[Demo](https://williammanco.github.io/performance-fps/public/)

## Features

	🎲 highly configurable
	☮️ dependecy free
	📦 only 2kB
	🚀 every frame ~0.07ms
	⚾ control bouncing effect (increase/decrease perf)
	🧟 execute live only on rAF (no internal timing)
	🙈 check reset when change tab (visibilitychange)


## Getting Started

Supports UMD, AMD and CommonJS format.

With NPM or yarn or download and use script

Clone this repository to generate build or take "performance-fps.min.js" from root

```
npm i performance-fps
```
```
yarn add performance-fps
```
```
<script src="performance-fps.min.js" type="text/javascript"></script>
```

## Usage

First instantiate the class
```
const checkFps = new PerformanceFps();
```
Push instance with update method on your rAF
```
const rAF = () => {
	checkFps.update();
	requestAnimationFrame(rAF);
};
```
Use onChange method to update your code with the performance when level change or check simply properties `checkFps.performance` in your code when deserve
```
checkFps.on('change', (e) => {
  this.yourPerformanceLevel = e;
});
```

## Default configuration and Options

You can set all or one of this option  with your parameters.
This configuration is setting with take balanced speed/quality of checked performance.

Use samples and accuracy to increase the speed and quality of check. 

```
const checkFps = new PerformanceFps({
    min: -2,
    max: 2,
    start: 0,
    samples: 100,
    accuracy: 64,
    delay: 2000,
    maxFps: 60,
    minFps: 30,
    checkFps: 54,
    upperCheckFps: 58,
    maxTryToUpper: 1,
    reCheckAfter: false,
});
```

Options | Default | Unit | Info
--- | --- | --- | ---
`min`| `-2` | `level` | use this option to limit min level of performance returned
`max`| `2` | `level` | use this option to limit max level of performance returned
`start`| `0` | `level` | start value of level
`samples`| `100` | `-` | used to take the average of fps, more (not much) samples make the average more accurate but increase the time to check, one sample take every ms value on accuracy option
`accuracy`| `64` | `ms` | time between every samples, more time less quality of check, this depends on current performance, if you have ~16ms/60fps the sample is taken every ~64ms
`delay`| `2000` | `ms` | start to check after this value
`maxFps`| `60` | `fps` | change if limit is upper than 60fps
`minFps`| `30` | `fps` | if current performance is lower a minimum level of performance is setted
`checkFps`| `54` | `fps` | limit of check, if lower decrease the level
`upperCheckFps`| `58` | `fps` | check update with this value to try upper level
`maxTryToUpper`| `1` | `times` | used to try to increase value if check fail more than 1 times
`reCheckAfter`| `false` | `ms` | after this time start recheck (and try to increase value)



## Next features and improvements

An external GUI with check properties 	to get configuration more simply and 	realtime for single project. 


## Motivation

It allows to make the project usable on different devices, able to make scalable and more adaptive to device.

## Author

William Manco @ https://twitter.com/williammanco

## License

[MIT](http://opensource.org/licenses/mit-license.php)

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