speedIndex
This function gives you back an index usually between 0 and 100 that represent the speed estimation of the computer on which this code runs. This index is calculated by estimating the loops (for) count that the computer can make in 100ms and make use of the “slow” and “fast” parameters that represent an average of how many loops a “slow” computer can do in this timeframe, vs how many loops a “fast” computer can make in this timeframe. You can totally update these parameters as you prefer. Note that these parameters can/will be updated during time to reflect the most average cases possible.
Params
- slow100000Number
How many loops a “slow” computer can make in 100ms
- fast1400000Number
How many loops a “fast” computer can make in 100ms
Return
- -Number
The speed index calculated from the passed params and the loops the computer can make in 100ms
Example
import { speedIndex } from '@blackbyte/sugar/perf';
speedIndex(); // 78Todo
- testsnormal
Author
- Olivier Bosselolivier.bossel@gmail.comhttps://blackbyte.space