1. #1
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,310
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default for vs array-foreach

    for vs array-foreach


    See this Ext.Array code fragment.

    According to jsPerf the most efficient way to iterate over an array or array-like collection is to avoid the native implementations entirely, opting for simple loops instead.

    http://jsperf.com/for-vs-array-foreach
    http://jsperf.com/for-vs-array-foreach/4


    Code:
    ...
    forEach: supportsForEach ? function(array, fn, scope) {
        return array.forEach(fn, scope);
    } : function(array, fn, scope) {
        var i = 0,
            ln = array.length;
    
    
        for (; i < ln; i++) {
            fn.call(scope, array[i], i, array);
        }
    },

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,310
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    Quote Originally Posted by LesJ View Post
    See this Ext.Array code fragment.

    According to jsPerf the most efficient way to iterate over an array or array-like collection is to avoid the native implementations entirely, opting for simple loops instead.

    http://jsperf.com/for-vs-array-foreach
    http://jsperf.com/for-vs-array-foreach/4


    Code:
    ...
    forEach: supportsForEach ? function(array, fn, scope) {
        return array.forEach(fn, scope);
    } : function(array, fn, scope) {
        var i = 0,
            ln = array.length;
    
    
        for (; i < ln; i++) {
            fn.call(scope, array[i], i, array);
        }
    },
    https://github.com/documentcloud/und...mment-16981731

    This is not very intuitive that native methods can be slower....

    "Avoiding native iteration methods wins more than just performance, as stated above there's also gains in consistency, portability, and simplicity."

  3. #3
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,310
    Vote Rating
    109
    LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light LesJ is a glorious beacon of light

      0  

    Default


    Quote Originally Posted by LesJ View Post
    See this Ext.Array code fragment.

    According to jsPerf the most efficient way to iterate over an array or array-like collection is to avoid the native implementations entirely, opting for simple loops instead.

    http://jsperf.com/for-vs-array-foreach
    http://jsperf.com/for-vs-array-foreach/4


    Code:
    ...
    forEach: supportsForEach ? function(array, fn, scope) {
        return array.forEach(fn, scope);
    } : function(array, fn, scope) {
        var i = 0,
            ln = array.length;
    
    
        for (; i < ln; i++) {
            fn.call(scope, array[i], i, array);
        }
    },
    Hint:
    It would be better if we ditched the es5 array iterations.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi