Hi guys.
I'm using a Polymer polyfills on some projects, and now had to use a WeakMap now.
I had to link to some frozen objects, so I had to rewrite it fully without relying on object properties.(I also wrote some methods for original WeakMap to fully comply the spec)
1e7 elements benchmark shows similar results and if returning simple object instead of
var mapObject = {};
Object.defineProperties(mapObject, {...});
return Object.freeze(mapObject);
chrome shows up to 3 times speeding up in comparison with original one.
Why does it happen is still a mystery for me, but however, guys, I would be glad if my solution will get into Polymer.
Here's a repo:
'fast-weakmap' is modified yours(i've expected that it will be really faster up to 5 times or so)
'good-weakmap' is my one(under good I mean "complying with ES6 and not creating attributes")