Are frozen Objects faster ?
Aymeric Vitte
vitteaymeric at gmail.com
Fri Feb 15 07:13:06 PST 2013
Typed Arrays are not frozen on FF, they are not extensible, only new
typed_array(nothing) is frozen (just bad luck for your example :-) ).
Reading this thread, it seems that I am not using good practices,
because I am using quite often the object literal indexed with numbers
(var a={};a[1]=something), and I am using delete to remove the values
(the object litteral becomes a kind of array with holes), and I really
expect delete to remove the property, not to assign it to null. I find
it convenient (despite of the fact that properties enumeration order in
that case is let to the appreciation of the js engine and can change
depending on what you are doing), is this not correct/impacting a lot
performances?
One day maybe there could be an annex in ES specs about good practices
and performances, or does it exist somewhere?
Regards,
Le 14/02/2013 21:50, Andrea Giammarchi a écrit :
> I wodner how come Firefox behaves like that then but I don't have
> tests to compare any difference between these two. I will write some,
> thanks
>
>
> On Thu, Feb 14, 2013 at 12:48 PM, Andreas Rossberg
> <rossberg at google.com <mailto:rossberg at google.com>> wrote:
>
> On 14 February 2013 21:36, Andrea Giammarchi
> <andrea.giammarchi at gmail.com <mailto:andrea.giammarchi at gmail.com>>
> wrote:
> > "Binary Arrays" are indeed frozen objects, at least in Firefox,
> and ultra
> > fast:
> > Object.isFrozen(new Float32Array()) // true in Firefox
> >
> > Since these are ultra fast in Chrome too but not frozen, I
> believe there is
> > already a way to speed up typed stuff (didn't check how it's
> done though) so
> > I wonder how come Object.freeze() is not taking similar approach
> "typizing"
> > behind the scene the object improving all static properties getters
> > (probably dropping those getters where possible unless defined
> as such)
>
> Frozenness is largely irrelevant for typed arrays, since all array
> accesses are defined by a magic nameless getter/setter pair per the
> WebIDL spec.
>
> /Andreas
>
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
--
jCore
Email : avitte at jcore.fr
iAnonym : http://www.ianonym.com
node-Tor : https://www.github.com/Ayms/node-Tor
GitHub : https://www.github.com/Ayms
Web : www.jcore.fr
Webble : www.webble.it
Extract Widget Mobile : www.extractwidget.com
BlimpMe! : www.blimpme.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130215/d5026fa5/attachment.html>
More information about the es-discuss
mailing list