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
Performance test for jQuery inline styling changes vs class toggling
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<style>
#button{
background: green;
position: absolute;
color: purple;
}
#button.toggledButton{
background : red;
top: 20px;
left: 10px;
color: blue;
border: 1px solid green;
}
</style>
<div id="button"></div>
var $button = $("#button");
if ($button.hasClass("toggledButton") {
$button.removeClass("toggledButton");
} else {
$button.attr("style", "");
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Inline-Stylings |
| ready |
Class Toggling |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.