Removal of WeakMap/WeakSet clear

Andreas Rossberg rossberg at google.com
Wed Dec 3 06:35:21 PST 2014


On 2 December 2014 at 19:15, Mark S. Miller <erights at google.com> wrote:
>> In both minor or major collection both m and v are immediately
>> reclaimed, because neither is strongly reachable at that point
>
> which shows the asymmetry, and that v8 is effectively optimizing for
> the wrong side of that asymmetry. By adopting what Allen and I refer
> to as the transposed representation (as opposed to your transposed
> representation), you'd instead be able to say of the common scenario
>
>> In both minor or major collection both k and v are immediately
>> reclaimed, because neither is strongly reachable at that point
>
> which would be much more valuable than any other efficiency issue
> discussed in this thread.

What I'm saying is that this is a theoretical conclusion at which you
arrive only under various simplifying and idealistic assumptions (such
as life time being the only factor that matters). I maintain that
there is no evidence yet that this actually translates to better
overall performance in practice, and I have severe doubts that it
would. I don’t want to reiterate the concerns that I already raised in
an earlier thread, but the executive summary is:

Good performance absolutely wants an object layout that is stable and
compact. The transposed weak map implementation pretty much is an
antithesis to that. It hence induces a potential cost on all key
objects (and all their uses throughout a program) instead of just the
maps. That is a case of optimising for the wrong thing as well.

(Back to the actual topic of this thread, you still owe me a reply
regarding why .clear is bad for security. ;) )

/Andreas


More information about the es-discuss mailing list