0.0.9 • Published 5 years ago

check-performance v0.0.9

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

check-performance

Small utility to check realtime performance level for scalable quality project. Check current performance based on fps/ms of project during navigation.

Example

Github repo

Install

yarn add check-performance

Features

  ☮️ dependecy free
  📦 598 byte (gzipped)
  🚀 every frame ~0.02ms
  🧟 no internal timing
  👟 flexible
  🤘 functional

Example

import checkPerf from 'check-performance'

let checked = false;

const onChange = (level) => {
  if (level < 3) { // level from 0 to 5
    console.log('limit quality', level)
    checked = true;
  }
}
const { update: updateCheckPerf } = checkPerf(onChange/*, options*/);

const rAF = () => {
	if (!checked) updateCheckPerf();
	requestAnimationFrame(rAF);
};

rAF();

Options

const options = {
  samples: 64, // number of samples (for FPS average)
  every: 32, // save sample every ~32ms
  limit: 55, // decrease/increase level from this FPS limit
  mode: 1, // 0 = sequential, 1 = precise
  maxLevel: 5, // max level quality
  maxFps: 60, // your fps limit
}

Build

yarn build

License

MIT © William Manco

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago