[OpenLayers-Dev] lib evaluation performance

Peter Robins openlayers at peterrobins.co.uk
Tue Nov 2 14:13:41 EDT 2010


I notice you're keeping CLASS_NAME
Not a major problem, but seems a bit illogical if there are no longer
any classes :-)

On 2 November 2010 09:52, Eric Lemoine <eric.lemoine at camptocamp.com> wrote:
> Hi
>
> 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
> using OpenLayers.Class to using pure JavaScript and OpenLayers.inherit
> 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.
>
> 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
>


More information about the Dev mailing list