Are frozen Objects faster ?

Andreas Rossberg rossberg at google.com
Thu Feb 14 12:48:33 PST 2013


On 14 February 2013 21:36, Andrea Giammarchi
<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


More information about the es-discuss mailing list