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

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.


> 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.




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

Search: