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
Testing: Heavy branching, string stuff, shifting, array / object iteration, array / object creation, charCodeAt etc.
<script type="text/javascript" src="https://github.com/BonsaiDen/BiSON.js/raw/master/bison.js"></script>
<script>
var encoded, decoded;
var ints = [],
floats = [],
dicts = [],
arrays = [],
bools = [],
strings = [];
for (var i = 0; i < 30; i++) {
ints.push(0);
ints.push(1);
ints.push(-5);
ints.push(1000);
ints.push(-2500);
ints.push(1000000);
ints.push(-2500000);
ints.push(2147483647);
ints.push(-2147483647);
floats.push(0.24);
floats.push(1.12);
floats.push(-5.98);
floats.push(1000.45);
floats.push(-2500.37);
floats.push(1000000.12);
floats.push(-2500000.64);
floats.push(2147483647.01);
floats.push(-2147483647.99);
dicts.push({});
dicts.push({
'a': {},
'b': {}
});
dicts.push({
'c': {
'f': {}
},
'd': {}
});
arrays.push([]);
arrays.push([
[],
[],
[]
]);
arrays.push([
[],
[
[],
[]
],
[
[],
[]
]
]);
bools.push(true);
bools.push(false);
bools.push(null);
bools.push(true);
bools.push(false);
bools.push(null);
bools.push(true);
bools.push(false);
bools.push(null);
bools.push(true);
bools.push(false);
bools.push(null);
strings.push('Foo');
strings.push('Hello World Hello World');
strings.push('The cake is a lie... The cake is a lie... The cake is a lie...');
strings.push('Hey listen! Hey listen!Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen! Hey listen!Hey listen! Hey listen! Hey listen! Hey listen!Hey listen! Hey listen! Hey listen! Hey listen!Hey listen!Hey listen!Hey listen!vHey listen!Hey listen!Hey listen!Hey listen!Hey listen!Hey listen!Hey listen!Hey listen!Hey listen!Hey listen!Hey listen!');
}
var intsE = BISON.encode(ints),
floatsE = BISON.encode(floats),
dictsE = BISON.encode(dicts),
arraysE = BISON.encode(arrays),
boolsE = BISON.encode(bools),
stringsE = BISON.encode(strings);
var intJ = JSON.stringify(ints),
floatsJ = JSON.stringify(floats),
dictsJ = JSON.stringify(dicts),
arraysE = JSON.stringify(arrays),
boolsJ = JSON.stringify(bools),
stringsJ = JSON.stringify(strings);
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Integer Encoding |
| ready |
Integer decoding |
| ready |
Float encoding |
| ready |
Float decoding |
| ready |
Array Encoding |
| ready |
Array Decoding |
| ready |
Object Encoding |
| ready |
Object decoding |
| ready |
Boolean Encoding |
| ready |
Boolean Decoding |
| ready |
String encoding |
| ready |
String decoding |
| ready |
Json String decoding |
| ready |
Json String encoding |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.