[OpenLayers-Dev] Re: lib evaluation performance

Xavier Mamano (jorix) xavier.mamano at gmail.com
Tue Nov 2 14:43:37 EDT 2010



Eric Lemoine-2-2 wrote:
> 
> Hi
> 
> To follow ...
> ...
> Chrome 7
> Old-style class: ~40ms (very unstable, from 26ms to 80ms)
> New-style class: ~30ms (very unstable)
> Inherit: ~30ms (very unstable)
> ...
> 
> Thanks,
> 
> --
> Eric Lemoine
> 
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
> 
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
> 
> 
Hi Eric Lemoine,

For other reasons I am also testing the performance of the initialization.
To stabilize a little the sample, I remove the extraneous peaks with this
code:

        function showAvg(testName,times) {
            function staValues(t) {
                var s = 0, v=0;
                for(var i=0, l=t.length; i<l; i++) {
                    s += t[i];
                    v += t[i]*t[i];
                }
                var ev ={};
                ev.avg = (s/l);
                // Normalized standard deviation
                ev.nsd = Math.sqrt((v/l)-(ev.avg*ev.avg))/ev.avg;
                ev.l = l;
                return ev;
            }
            var t = times.slice(0);
            t = t.sort(function (a,b){return a - b;}); // sort ascending
            var ev;
            while (true) {
                ev = staValues(t);
                if (ev.avg == 0 ||    // break if all values are 0
                    ev.nsd <= 0.5 ||   // clean up of the normalized
standard deviation is less than 0.5
                    ev.l <= times.length * 2/3 // remove 1/3 of the sample
maximum.
                    ) {
                    break;
                }
                console.log(testName+";", ev.avg.toFixed(1), "; max;",
t[ev.l-1], "; nsd;", ev.nsd.toFixed(3), "; sample;", ev.l); // to monitor
cleaning
                t.pop(); // remove the anomalous peak produced by the
garbage collect or other
                t.shift(); // remove the minimum to balance the sample
            }
            console.log(testName+":", ev.avg.toFixed(1));
        }

used by:

       showAvg("Old-style class",timesArray);


Xavier

-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/lib-evaluation-performance-tp5696447p5698676.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.


More information about the Dev mailing list