-
Notifications
You must be signed in to change notification settings - Fork 29
Description
The Rust compiler uses string interning to optimize the storage size and comparison time of strings, however there is a performance cost anytime an interned string (represented as a u32
) is converted to and from a &str
.
rust-lang/rust#138682 has landed, meaning will can now set Config::extra_symbols
with a list of strings that should be pre-interned by the compiler. We can then create these predefined symbols quickly using Symbol::new()
and PREDEFINED_SYMBOLS_COUNT
, avoiding any global locks.
We should use this new system to pre-intern any strings that we use in bevy_lint
. Extra thought should be put into how we design this, as the system that we use to should make it easy to add new strings in the future in a way that doesn't break existing code.