bench-fps
v1.0.0
Published
FPS (frames per second) benchmark utility for perf testing.
Downloads
5
Readme
FPS (frames per second) benchmark utility for perf testing.
Examples
import { benchFPS } from 'bench-fps'
describe('perf', () => {
it('wheeling', async () => {
const { aggregateStats: aggr } = await benchFPS(3, 4000, x => {
window.dispatchEvent(
new WheelEvent('wheel', {
deltaY: (Math.random() - 0.5) * Math.sin(x * Math.cos(x * 0.5) * 0.05)
* 250,
})
)
})
console.table(aggr)
expect(aggr.min).toBeGreaterThan(15)
expect(aggr.mean).toBeGreaterThan(58)
expect(aggr.meanStd).toBeLessThan(1.2)
})
})
API
Credits
- everyday-math by stagas – Everyday math utilities.
- everyday-utils by stagas – Everyday utilities
Contributing
All contributions are welcome!
License
MIT © 2022 stagas