Are frozen Objects faster ?

Andreas Rossberg rossberg at google.com
Thu Feb 14 12:18:44 PST 2013


On 14 February 2013 20:56, Herby Vojčík <herby at mailbox.sk> wrote:
> The problem is proliferation of `foo.bar = null` in "normal" code, where
> sometimes you want to remove some property (maybe it was an expando, or it
> is realy not needed any more in the actual phases of the lifecycle). In such
> cases, doing `delete` would degrade your optimized instance into a Hash.
> Thus, people do `foo.bar = null` even if what they want to do is `delete
> foo.bar`.

By definition, if you want to delete it, it's not a "normal" property.
In most languages, you couldn't even do that. The reason that you can
in JavaScript is mostly historic. (And fortunately, I don't see a
"proliferation" of this in practice.)

/Andreas


More information about the es-discuss mailing list