Re:ES6 in Depth – Symbols
by pavlov on Friday June 12, 2015 @09:47AM
(#9705797)
Making the registry global allows compilers to optimize away those Symbol.for() calls, since they know that each call to Symbol.for("cat") is going to resolve to the same symbol instance.
[ Parent
| on HN ]
But if people are concerned about performance, they can just pre-allocate/memoize the symbols.
It doesn't seem like the registry adds any new functionality, and it might encourage use of globals. Surely that's a bad thing?