You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our scanner copies the string contents of every token when creating it. But many tokens share the same source string:
Whitespaces.
Newlines.
Common keywords like public, contract, function.
We should calculate the most frequent tokens (using sanctuary datasets), and define them as static/const values in source, returning static references when possible, to eliminate allocations:
Our scanner copies the string contents of every token when creating it. But many tokens share the same source string:
public
,contract
,function
.We should calculate the most frequent tokens (using sanctuary datasets), and define them as static/const values in source, returning static references when possible, to eliminate allocations:
phf::Set::get_key
inToken::new()
to fetch the static refs and store them instead of cloning the original input, similar tosmol_str::SmolStr::new_static
.Token::new()
asconst
, storing the entire object instead of just the string in thephf
map.Rc<Token>
, so that all of them share the same instance/pointer.Once we have #808, we can evaluate the impact of these optimizations.
The text was updated successfully, but these errors were encountered: