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
I have an application which stores coordinates and performs calculation on them. I wanted to know if a matrix or an object would be a better choice.
My experience: every f***ing browser have a different result. firefox : the 2. one is the fastest ie : the 4. is the fastest but only with a little chrome : the 4. is twice as fast as any other...
Ok, first i only used 100 iterations to produce data, now i use 10000 and now i get consistent results.
var arr = [],
point = function(y){ this.x = y; },
obj = { array : [] };
for(var i = 0; i < 10000; i++) {
obj.array.push(new point(i));
var nested_arr = [1];
arr.push(nested_arr);
};
var process = {
object_sin : function(degree, point){
point.x = Math.sin(rad(degree));
},
array_sin : function(degree, i, y){
arr[i][y] = Math.sin(rad(degree));
},
};
function rad(degree){
return Math.PI*degree/180;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Nested Array Performance |
| ready |
Nested Array Performance |
| ready |
Nested Array Performance |
| ready |
Object with array property storing objects performance |
| ready |
Object with array property storing objects performance |
| ready |
Object with array property storing objects performance |
| ready |
Object with array property storing objects performance |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.