Open NightlyFox opened 5 years ago
If there are people who are trying to get as much performance increase as possible, placing the folowing code at the top of the minified version of ui-grid seems to override all of the forEach and map prototype references without having to manually change any of the code. (i tested this with console logs to make sure)
Array.prototype.map=function(a){let l=this.length, array=new Array(l),i=0;for(;i<l;i++){array[i]=a(this[i],i)}return array;};Array.prototype.forEach=function(a){let l=this.length, i=0;for(;i<l;i++)a(this[i],i)};
as for real life testing, it does not seem to have any noticeable effects on performance, but it wont hurt. The performance numbers are there though.
Is there a bigger study on this topic?
I tested the map change on an array containing 113,267 strings. The perf was measurably worse than the built in map.
http://jsben.ch/N3AVA
Looking at the performance of the faster ForEach/map functions written you can see that significant performance increase happens over the built in forEach/map prototype on a javascript array.
I saw that ui-grid uses the built in prototypes and figured they could use a performance increase so that ui-grid becomes more responsive with larger grid sizes. The larger the array, the more significant of a performance increase it has!