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
<div id="list">
<div data-code="1">1</div>
<div data-code="2">2</div>
<div data-code="3">3</div>
<div data-code="4">4</div>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$.expr[':'].data = function(elem, counter, params) {
if(!elem || !params)
return false;
var query = params[3];
if(query)
{
var split = query.split('=');
var data = $(elem).data(split[0]);
if(data) {
// If the query was just checking to see if the
// field existed, then we're good!
if(split.length == 1)
return true;
return (data+'') == split[1];
}
}
return false;
};
</script>
var code = '4';
var $divs = $('#list div');
Ready to run.
Test | Ops/sec | |
---|---|---|
.filter(function) |
| ready |
.filter(':data()') |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.