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
<script src="https://code.jquery.com/jquery-1.9.1.min.js">
</script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular.min.js">
</script>
<script src="https://rawgithub.com/wycats/handlebars.js/1.0.0-rc.3/dist/handlebars.js"></script>
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js">
</script>
<!-- Angular -->
<div ng-app="ANGAPP" id="angapp" ng-controller="Ctrl">
<h3>
Angular
</h3>
<span id="items" ng-repeat="item in items">
{{item}}
</span>
</div>
<!-- Backbone -->
<div id="backboneapp">
<h3>
Backbone
</h3>
<span class="backbone-items">
</span>
</div>
<script>
// Angular
angular.module('ANGAPP', []).controller('Ctrl', function($scope) {
$scope.items = [];
$scope.clear = function() {
$scope.items.splice(0);
//$scope.$digest();
};
$scope.push = function(item) {
$scope.items.push(item);
//$scope.$digest();
};
});
window.ANG = {
clear: angular.element(document.getElementById("angapp")).scope().$apply(function () { angular.element(document.getElementById("angapp")).scope().clear()}),
push: angular.element(document.getElementById("angapp")).scope().$apply(function () { angular.element(document.getElementById("angapp")).scope().push()})
};
// Backbone.js
var backboneView = Backbone.View.extend({
template: Handlebars.compile("{{#each items}}{{x}} {{/each}}"),
initialize: function() {
this.collection = new Backbone.Collection();
this.collection.on('add', this.render.bind(this));
_.bindAll(this);
},
render: function() {
this.$el.html(this.template({
items: _.pluck(this.collection.models, 'attributes')
}));
},
push: function(i) {
this.collection.add({
x: i
});
},
clear: function() {
this.collection.reset();
}
});
window.BB = new backboneView({
el: "#backboneapp .backbone-items"
});
console.log(window.BB);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Angular 10 |
| ready |
Backbone 10 |
| ready |
Angular 50 |
| ready |
Backbone 50 |
| ready |
Angular 100 |
| ready |
Backbone 100 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.