Fwd: Removal of WeakMap/WeakSet clear

Mark S. Miller erights at google.com
Tue Dec 9 14:59:17 PST 2014

[Katelyn, I decided to share this challenge publicly]

I very much respect experience-driven feedback [...].
[For any of you with an implementation based use case for WeakCollections,
do] you have, or can you cook up based on what you have, a
realistic performance critical use of WeakMap with .clear? If so, can
I ask you to do the following experiment:

Benchmark your use on a browser currently supporting builtin WeakMaps
with clear.


  class ClearableWeakMap {
    constructor(...args) {
      this.wm = new WeakMap(...args);
    get(key) { return this.wm.get(key); }
    // etc... for anything you're using other than clear

    clear() {
      this.wm = new WeakMap();

The reason I ask is we're all assuming that this is slower. It may be.
But [if] you have a realistic use you believe in, I'm curious what
numbers you see. Thanks!

[In addition, if anyone wants to try micro benchmarks with no claim to
engineering realism, I'd still be curious what they say. Thanks]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20141209/b1644b59/attachment.html>

More information about the es-discuss mailing list