WeakMap.prototype.set should return a TypeError#13059
WeakMap.prototype.set should return a TypeError#13059jasonmit wants to merge 1 commit intoemberjs:masterfrom jasonmit:patch-3
Conversation
|
@jasonmit I'm unsure is this is a tradeoff between spec adherence vs. performance. /cc @stefanpenner |
|
Ya I'm curious as to the performance impact, if we do decide to keep the assertion around in prod, the following may be the most performant variant. (largely focusing on keeping AST size to a min, so allow for more inlining). var type = typeof obj;
if (obj && (type === 'object' || type === 'function')) {
metaFor(obj).writableWeak()[this._id] = (value === undefined ? UNDEFINED : value);
return this;
}
invalidKey()Obviously this may just be pre-mature optimization, but I am genuinely curious as to the impact. https://github.com/stefanpenner/do-you-even-bench may be used to quickly test the differences My guess is |
|
☔ The latest upstream changes (presumably #13658) made this pull request unmergeable. Please resolve the merge conflicts. |
|
cc @jasonmit |
https://tc39.github.io/ecma262/#sec-weakmap.prototype.set
Related: thoov/ember-weakmap#3