-
-
Notifications
You must be signed in to change notification settings - Fork 401
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
Use smol_str
for identifiers
#565
Comments
After looking into lasso's usage, specifically for node identifiers, at which scope would you want the cache to be kept at? |
But in fact, this might be easier if this was a property of a |
Was looking into the property of a Boa structure, in doing so would the constructor have to call the constructor of the lexer, the parser and the interpreter, or would those be passed into the constructor to hold as a pointer. I also was trying to make the structure for the interner less convoluted by generating its own method, but can't access the Key type as it's private, if you have any suggestions to get around this, it would be much appreciated. |
@Razican this can be unblocked now right? As both changes have now landed. |
Also @Razican currently the type being used is |
This will no longer be implemented, as interned strings will be used instead. |
Currently, we use a partially optimised version of
String
for identifiers and function names parsing and lexing. While it's OK, we could greatly benefit from using small strings that will usually be stored inline.The
smol_str
crate was made for this, and it's being used on rust-analyzer, for example. It will store up to 22-bytes (ASCII characters) inline, in the stack, and then do some optimisations for whitespace strings. It will then store bigger strings in Rc'd heap allocations. It uses immutable strings, though, but identifiers don't change.A nice review on this and other crates was done by Amos here.
This should especially help with minified code, that we will be benchmarking in #564.
This is waiting for #564 and #559.
The text was updated successfully, but these errors were encountered: