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
Determines which is faster: one KnockoutJS binding of 5 complex objects or 5 bindings of 1 complex object each.
Also attempting to clean up the DOM between tests.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/knockout/3.1.0/knockout-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/knockout.mapping/2.4.1/knockout.mapping.js"></script>
<script>
var counter = 1;
var myObject = function( name ) {
var self = this;
self.items = [];
for (var i = 0; i < 5; i++) {
self.items.push(name + i);
}
return self;
};
var obj = new myObject( "A" );
var obj1 = ko.mapping.fromJS( obj );
var obj = new myObject( "B" );
var obj2 = ko.mapping.fromJS( obj );
var obj = new myObject( "C" );
var obj3 = ko.mapping.fromJS( obj );
var obj = new myObject( "D" );
var obj4 = ko.mapping.fromJS( obj );
var obj = new myObject( "E" );
var obj5 = ko.mapping.fromJS( obj );
var objectAll = {
obj1:obj1,
obj2:obj2,
obj3:obj3,
obj4:obj4,
obj5:obj5
};
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Five Bindings |
| ready |
One Binding |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.