[OpenLayers-Dev] lib evaluation performance
frederic.junod at camptocamp.com
Tue Nov 2 10:24:21 EDT 2010
Thanks for the experiments and the benchmarks; I'm currently doing
some experiments with the Google Closure Compiler and I would like to
use your patch; so I'm +1 to push the code to the github repository.
On Tue, Nov 2, 2010 at 10:52 AM, Eric Lemoine
<eric.lemoine at camptocamp.com> wrote:
> To follow up on <http://trac.osgeo.org/openlayers/ticket/2899> I've
> run experiments to evaluate the time it takes for the browser's js
> engine to do the initial evaluation of the library.
> I've run experiments with three versions of the library:
> - "Old-style class" - in this version the old OpenLayers.Class
> implementation is used (prior to changeset 10858)
> - "New-style class" - in this version the new OpenLayers.Class
> implementation is used. This version is the current trunk.
> - "Inherit" - in this version all type definitions are converted from
> for base types and sub-types, respectively.
> The evaluation time is measured by adding timestamps (new Date) at the
> beginning and end of a "full" OpenLayers.js build.
> Here are the results for a number of browsers:
> FF 4 Nightly
> Old-style class: 30ms
> New-style class: 20ms
> Inherit : 18ms
> FF 3
> Old-style class: 37ms
> New-style class: 30ms
> Inherit: 27ms
> Chrome 7
> Old-style class: ~40ms (very unstable, from 26ms to 80ms)
> New-style class: ~30ms (very unstable)
> Inherit: ~30ms (very unstable)
> IE 7
> Old-style class: 47ms
> New-style class: 31ms
> Inherit: 15ms or 30ms
> IE 6
> Old-style clas : 78ms
> New-style class : 35ms
> Inherit: 15ms or 30ms
> Safari 3:
> Old-style class : 25ms
> New-style class: 18ms (unstable)
> Inherit: 15ms (unstable)
> The results show that not only does the new OpenLayers.Class
> implementation improve "runtime" performance it also leads to a
> smaller evaluation time, when compared to the old OpenLayers.Class.
> That's good. "Inherit" reduces evaluation time even more, but this
> isn't significant.
> With these results, and taken into account that OpenLayers.Class isn't
> needed anymore now that we have OpenLayers.inherit, I'd like to
> propose to remove OpenLayers.Class entirely in our OpenLayers 3 Github
> repository. This change cannot be done in 2.x as it will break
> application code defining classes using OpenLayers.Class, this is
> because the constructors no longer have an "initialize" method in
> their prototypes.
> I have a patch ready, see
> <http://erilem.net/patches/openlayers/patch-openlayers-2899.diff>. All
> tests pass. I just still need to update some of the examples, so they
> use OpenLayers.inherit instead of OpenLayers.Class when definiting
> specific types. I couldn't attach the patch to a track ticket because
> its size exceeds the limit.
> 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
> Dev mailing list
> Dev at lists.osgeo.org
More information about the Dev