jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
var red = 0,
green = 150,
blue = 145.67;
// Raphaël.js
function raphael(red, green, blue) {
var r = (~~red).toString(16),
g = (~~green).toString(16),
b = (~~blue).toString(16);
return r + g + b;
}
function rgbtohex2(red, green, blue) {
return '#' + (0x1000000 | blue | (green << 8) | (red << 16)).toString(16).slice(1);
}
// Garrett’s
function garrett(r, g, b) {
return (toHexString = _toHexString)(r,g,b);
function _toHexString(r, g, b) {
return "#" + toHexByte(r) + toHexByte(g) + toHexByte(b);
}
function toHexByte(bite) {
var hex = bite.toString(16);
return (hex.length === 2 ? hex : "0" + hex);
}
}
// atesgoral’s
function atesgoral(a,b,c) {
return"#" + ((256 + a << 8 | b) << 8 | c).toString(16).slice(1);
}
// Asen’s
function asen(r, g, b) {
return ("00000" + (r << 16 | g << 8 | b).toString(16)).slice(-6);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Raphael |
| ready |
2 |
| ready |
Garrett’s |
| ready |
atesgoral’s |
| ready |
Asen’s |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.