Fireball
Breakpoints for performance.
Fireball is a small script that runs when your web page is loaded. It generates a score based on the performance of the user's hardware.
It hands off the work to a different thread so won't slow the rest of your site down while it's running.
Installation
npm install fireball --save
bower install fireball
Example usage
Setup
Fireball uses a Worker to calculate a score, which is loaded dynamically when fireball initialises. No need to host the worker script in another file.
Running fireball, the simple way
var Fireball = ;Fireball;
or if adding the script directly or using bower Fireball will be already available:
Fireball;
The resulting score will be available in your JavaScript as Fireball.getScore()
after a few seconds.
if Fireball > 8000 //Do something to delight the user else //Do something boring but easy on the CPU
Running fireball with classes
Fireball;
These breakpoints will be added as classes to the <body>
so you can target them in CSS. E.g.
Running fireball with all the bells and whistles
Fireball;
You can also register a callback like so.
Fireball.onSuccess(callback);
callback
will be passed a single argument, the score.
This is handy if you have a modular system and want to access the fireball score in a different module without using a global variable. If the score has already been calculated this will execute immediately.
Browser support
Chrome, Firefox, Safari, Android 4.4+.
Won't work in the current IE (11) or Edge (25).
Benchmark
The Fireball score is roughly aligned with the Octane benchmark score; if a machine gets 15,000 on octane, the Fireball score will be within a few thousand of that. Probably.
Check out the demo on my site to see what score your machine gets.