-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Split symbol interner into static unsynchronized and dynamic synchronized parts #79425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ tracing = "0.1" | |
sha-1 = "0.9" | ||
sha2 = "0.9" | ||
md-5 = "0.9" | ||
phf = "0.8" |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1452,17 +1452,55 @@ impl Symbol { | |||||
Symbol(SymbolIndex::from_u32(n)) | ||||||
} | ||||||
|
||||||
/// Maps a string to its interned representation, but only if this string is a known | ||||||
/// (static) symbol. | ||||||
pub fn intern_static(string: &str) -> Option<Symbol> { | ||||||
if let Some(symbol) = STATIC_SYMBOLS_PHF.get(string) { Some(*symbol) } else { None } | ||||||
|
if let Some(symbol) = STATIC_SYMBOLS_PHF.get(string) { Some(*symbol) } else { None } | |
STATIC_SYMBOLS_PHF.get(string).copied() |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary?
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn as_str_static(self) -> Option<&'static str> { | |
fn as_str_static(self) -> Option<&'static str> { |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
STATIC_SYMBOLS.get(self.0.as_usize()).copied() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.