[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.

Substitute

  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]

-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to