Are frozen Objects faster ?

Herby Vojčík herby at mailbox.sk
Thu Feb 14 10:26:54 PST 2013



Mark S. Miller wrote:
>
>
>
> On Thu, Feb 14, 2013 at 10:09 AM, Herby Vojčík <herby at mailbox.sk
> <mailto:herby at mailbox.sk>> wrote:
>
>
>
>     Kevin Gadd wrote:
>
>         Frozen and sealed objects are both dramatically slower in most JS
>         engines I've tested. In the ones where they're not dramatically
>         slower
>         they are never faster.
>
>         The last time I asked on the mozilla and v8 bug trackers I was
>         informed that there is no plan to optimize for these features
>         and that
>         the design of the respective JS engines would make such
>         optimizations
>         difficult anyway.
>
>         (I find this extremely unfortunate.)
>
>
>     I, on the other hand, find it fortunate. Otherwise, some people
>     would prematurely freeze objects to gain speed. It would be same
>     <del>disaster</del> akwardness as v8 did with removing `delete` in
>     favour of `= null`.
>
>
> What are you referring to? What 'delete' was removed?

I meant "de facto". People wanting to remove property bar from foo do 
not write `delete foo.bar` anymore; they (at least some significant 
subset) have learned to write `foo.bar = null;` or `foo.bar = 
undefined;`. The reason is perf - `delete` deoptimized hidden classes.

>     Herby
>
>         -kg
>
> --
>      Cheers,
>      --MarkM


More information about the es-discuss mailing list