Re:Microfeatures I'd like to see in more languages
by progval on Thursday January 05, 2023 @04:34PM
(#34267001)
Symbols can even improve performance. Replace them with integers at compile time like a global enum, and so the runtime only needs to compare integers instead of potentially lengthy (especially if UTF-16) strings.
[ Parent
| on HN ]
Re:Microfeatures I'd like to see in more languages
by masklinn on Thursday January 05, 2023 @04:43PM
(#34267146)
> Replace them with integers at compile time like a global enum, and so the runtime only needs to compare integers instead of potentially lengthy (especially if UTF-16) strings.
All of those strings will be interned, and can thus be compared by identity. Which is an integer comparison.