Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


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?




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: