[OpenLayers-Dev] Re: [OpenLayers 3] type instantiation performance

Andreas Hocevar ahocevar at opengeo.org
Fri Oct 22 08:03:22 EDT 2010


Now why wait for 3.0? This can easily be wrapped into OpenLayers.Class (and that's what I was hoping for when I meant "OpenLayers.Class has room for improvement"). I have just created http://trac.osgeo.org/openlayers/ticket/2899.

Some results with the patch I have attached to that ticket, which basically turns OpenLayers.Class into "Pure JavaScript":

Safari 5:
OpenLayers.Class 15.65
Pure JavaScript 19.1
Object Litteral 13.7

Firefox 3.6.10:
OpenLayers.Class 63.7
Pure JavaScript 60.15
Object Litteral 62.1

Regards,
Andreas.

On Oct 22, 2010, at 10:36 , Andreas Hocevar wrote:

> Alright. Sorry, I had missed your initial posting that contained all this.
> 
> /me should not raise voice without reading the whole thread thoroughly.
> 
> The part that I had missed was that your proposal was to get rid of OpenLayers.Class entirely. I agree that this change makes more sense than working around an expensive instantiation through OpenLayers.Class.
> 
> Thanks,
> Andreas.
> 
> On Oct 22, 2010, at 10:12 , Eric Lemoine wrote:
> 
>> On Friday, October 22, 2010, Andreas Hocevar <ahocevar at opengeo.org> wrote:
>>> It will be good to see this "pure JS" approach in action, with actual code. Especially how subclassing and instanceof checking for any class in the inheritance chain would work.
>> 
>> Just look at my OpenLayers.inherit function and the examples I provided.
>> 
>> Basically;
>> 
>> P = function() {
>> };
>> P.prototype = {
>> };
>> p = new P;
>> p instanceof P;
>> 
>> C = function() {
>>   P.call(this);
>> };
>> OpenLayers.inherit(C, P, {
>> });
>> c = new C;
>> c instanceof C;
>> c instanceof P;
>> 
>> -- 
>> 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
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> 
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev

-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Dev mailing list