[OpenLayers-Dev] type instantiation performance

XinGang Li slinavlee at gmail.com
Fri Oct 22 09:16:26 EDT 2010


And more, the clone mothed will make more parseFloat call.

Li XinGang
EMail: slinavlee at gmail.com
Blog:   avlee.cnblogs.com
Site:    www.mapboost.org


On Fri, Oct 22, 2010 at 8:03 PM, Andreas Hocevar <ahocevar at opengeo.org>wrote:

> 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.
>
> _______________________________________________
> Dev mailing list
> Dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20101022/683cef28/attachment.html


More information about the Dev mailing list