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
A modified version of the first few revisions that accounts for any speedup gained when referencing the same jQuery object in a variable instead of repeatedly using the jQuery selector.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<style type="text/css">
.newClass {
background-color:red;
}
.otherClass {
background-color: green;
}
</style>
<div class="some preexisting classes"></div>
var jqueryDiv = $('div');
$('div').remove();
$('body').append('<div class="some preexisting classes otherClass"></div>');
Ready to run.
Test | Ops/sec | |
---|---|---|
Remove and Add class |
| ready |
Apply CSS |
| ready |
Add Class |
| ready |
Plain JS Replace Class |
| ready |
Plain JS Replace Class v2 |
| ready |
Remove and Add class (jQuery Object Predefined) |
| ready |
Apply CSS (jQuery Object Predefined) |
| ready |
Add Class (jQuery Object Predefined) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.