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/jquery/1/jquery.min.js"></script>
<script src="https://documentcloud.github.com/underscore/underscore.js"></script>
<script>
(function(window) {
var hasOwnProperty = {}.hasOwnProperty,
toString = {}.toString;
_.mixin({
// Is a given variable an arguments object?
isArgumentsNew: toString.call(arguments) == '[object Arguments]'
? function(obj) {
return toString.call(obj) == '[object Arguments]';
}
: function(obj) {
return !!(obj && hasOwnProperty.call(obj, 'callee'));
},
// Is a given value a function?
isFunctionNew: function(obj) {
return toString.call(obj) == '[object Function]';
},
// Is a given value a string?
isStringNew: function(obj) {
return toString.call(obj) == '[object String]';
},
// Is a given value a number?
isNumberNew: function(obj) {
return toString.call(obj) == '[object Number]';
},
// Is a given value a date?
isDateNew: function(obj) {
return toString.call(obj) == '[object Date]';
},
// Is the given value a regular expression?
isRegExpNew: function(obj) {
return toString.call(obj) == '[object RegExp]';
}
});
window._typeof = {
// Is a given value a function?
isFunction: function(obj) {
return typeof obj == 'function';
},
// Is a given value a string?
isString: function(obj) {
return typeof obj == 'string';
},
// Is a given value a number?
isNumber: function(obj) {
return typeof obj == 'number';
},
// Is a given value a date?
isDate: function(obj) {
return obj instanceof Date;
},
// Is the given value a regular expression?
isRegExp: function(obj) {
return obj instanceof RegExp;
}
};
}(window));
</script>
var $ = window.jQuery,
_ = window._,
array = [1, 2, 3],
func = function(){},
string = "string",
number = 101,
date = new Date,
regexp = /regexp/i;
Ready to run.
Test | Ops/sec | |
---|---|---|
Current Implementation |
| ready |
Proposed Implementation |
| ready |
Sanity Check |
| ready |
typeof |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.