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
set immediate test
<script>
setTimeout(function () {
if (!window.setImmediate) {
ui.benchmarks[0].options.defer = false;
}
if (!window.msSetImmediate) {
ui.benchmarks[2].options.defer = false;
}
if (!window.MessageChannel) {
ui.benchmarks[3].options.defer = false;
} else {
window.immediateChannel = new MessageChannel();
}
if ("onreadystatechange" in document.createElement("script")) {
window.readyStateChange = true;
} else {
ui.benchmarks[4].options.defer = false;
}
if (!window.postMessage) {
ui.benchmarks[5].options.defer = false;
} else {
window.immediateCallbacks = {};
var onGlobalMessage = function (event) {
if (event.source === window && event.data.indexOf('immediate') === 0) {
var handle = 'h' + event.data.substring(9);
immediateCallbacks[handle]();
delete immediateCallbacks[handle];
}
};
if (window.addEventListener) {
window.addEventListener("message", onGlobalMessage, false);
} else {
window.attachEvent("onmessage", onGlobalMessage);
}
}
}, 0);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
setImmediate |
| ready |
setTimeout |
| ready |
msSetImmediate |
| ready |
MessageChannel |
| ready |
readyStateChange |
| ready |
postMessage |
| ready |
requestAnimationFrame |
| ready |
image + data-url |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.