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://ajax.googleapis.com/ajax/libs/yui/2.9.0/build/yuiloader/yuiloader-min.js"></script>
<script src="https://www.cinsoft.net/mylib099-min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://code.jquery.com/jquery-1.9.1.min.js">
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/2.0.0/handlebars.min.js"></script>
<!-------- Angular -------->
<div ng-app="ANGAPP" id="angapp" ng-controller="Ctrl">
<h3>Angular</h3>
<span ng-repeat="item in items">{{item}}</span>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.9/angular.min.js">
</script>
<script>
angular.module('ANGAPP', [])
.controller('Ctrl', function($scope) {
$scope.items = [];
$scope.clear = function(){$scope.items = [];};
$scope.push = function(item){ $scope.items.push(item);};
window.ANG = {
$scope : $scope
};
});
</script>
<!-------- End Angular -------->
<!-------- CanJS -------->
<script src="http://canjs.com/release/1.1.7/can.jquery.js"></script>
<script src="http://canjs.com/release/1.1.7/can.view.mustache.js"></script>
<div id="canjsmustacheapp"></div>
<div id="canjsejsapp"></div>
<script id='canjsMustacheTemplate' type='text/mustache'>
<h3>CanJS (Mustache):</h3>
<span class="canjs-items">{{#items}}{{.}}{{/items}}</span>
</script>
<script>
var canjsList1 = new can.Observe.List([]);
var canjsControl = can.Control.extend({
init: function(el, options) {
this.element.html(can.view(this.options.template, { items: this.options.items }));
},
push: function(i) {
this.options.items.push(i);
},
clear: function() {
this.options.items.splice(0, this.options.items.length);
}
});
window.CanJS = new canjsControl('#canjsmustacheapp', {
template: 'canjsMustacheTemplate',
items: canjsList1
});
</script>
<!-------- End CanJS -------->
<!-------- Backbone-------->
<div id="backboneapp">
<h3>Backbone</h3>
<span class="backbone-items"></span>
</div>
<script src="https://underscorejs.org/underscore.js"></script>
<script src="https://backbonejs.org/backbone.js"></script>
<script type="text/template" id="bbTpl">
<% _.each(items,function(item){ %>
<%= item %>
<% }) %>
</script>
<script>
// Backbone.js
var backboneView = Backbone.View.extend({
tpl: _.template($('#bbTpl').html()),
items: [],
push: function(i) {
this.items.push(i);
},
render: function() {
this.$el.html(this.tpl({items:this.items}));
},
clear: function() {
this.items = [];
this.$el.empty();
}
});
window.BB = new backboneView({el: "#backboneapp .backbone-items"});
</script>
<!-------- End Backbone -------->
<!-------- Knockout -------->
<h3>Knockout</h3>
<span data-bind='foreach: items'><span data-bind="text: $data"></span></span>
<script src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-3.0.0.js"></script>
<script>
// Knockout.js
window.KO = {
items: ko.observableArray([]),
clear: function() {
this.items([]);
},
push: function(item) {
this.items.push(item);
}
}
ko.applyBindings(KO);
</script>
<!-------- End Knockout -------->
<!-------- Ember-------->
<div id="emapp">
<h3>Ember:</h3>
<script type="text/x-handlebars">
<span>
{{#each EMapp.data}}<span>{{this}}</span>{{/each}}
</span>
</script>
</div>
<script src="https://ajax.aspnetcdn.com/ajax/knockout/knockout-3.0.0.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.9.1/ember.min.js"></script>
<script>
EMapp = Ember.Application.create({
rootElement: $('#emapp')
});
EMapp.data = Ember.A();
EMclear = function () {
EMapp.get('data').clear();
};
EMreset = function () {
EMapp.set('data', Ember.A());
};
EMpush = function (data) {
EMapp.get('data').pushObject(data);
};
</script>
<!-------- End Ember -------->
Ready to run.
Test | Ops/sec | |
---|---|---|
Angular |
| ready |
CanJS |
| ready |
Backbone |
| ready |
Knockout |
| ready |
Ember |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.