You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks; I've been interested in doing this for some time. But, I'm concerned about the performance hit. Can you post the results of the jsdom benchmark suite before and after?
The large variability combined with the giant slowdown in the create* tests makes me kinda wary of this. Are we doing something weird in createNode that taxes on WeakMaps so much?
I ran the benchmark locally and I was able to measure a noticeable slowdown locally. All the interface creation tests are 3x slower using WeakMap instead of a Symbol. You can see below the benchmark results I gathered locally on Node 12.13.1. I also ran the same benchmark against Node 13.6.0, and the results are comparable.
The variability of the benchmark results might be explained by 2 things:
with the overall slowdown, benchmark.js uses fewer samples for each benchmark.
looking at a couple of CPU profiles, we can see that each GC takes way longer in the WeakMap version compared to the Symbol one.
Based on the benchmark data, I feel uncomfortable introducing such a large regression compared to the value-added.
Benchmark result on Macbook Pro 2015 / Node 12.13.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, wrapper → impl mapping is done using a symbol.
The issue with this approach is that it causes several observable
[[Get]]s on the object, which causes some WPT failures, and can lead to implementation leakage, as described in the class fields proposal.