2 ms·
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 t
by pavlov 11y ago
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.
- agd 11y agoBut 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?