-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Reduce Result<Tok, LexicalError>
size by using Box<str>
instead of String
#9885
Conversation
CodSpeed Performance ReportMerging #9885 will not alter performanceComparing Summary
|
6a2377f
to
752ad62
Compare
534fa8a
to
6b0a6a1
Compare
752ad62
to
632a347
Compare
6b0a6a1
to
da6e993
Compare
632a347
to
1ec90fb
Compare
da6e993
to
20ae19c
Compare
|
4c7142b
to
e232f73
Compare
Tok
size by using Box<str>
instead of String
Tok
and Result<Tok, LexicalError>
sizes by using Box<str>
instead of String
Tok
and Result<Tok, LexicalError>
sizes by using Box<str>
instead of String
Result<Tok, LexicalError>
size by using Box<str>
instead of String
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.
Nice!!!
crates/ruff_linter/src/rules/pycodestyle/rules/invalid_escape_sequence.rs
Outdated
Show resolved
Hide resolved
I'm not kidding I was thinking about this as I fell asleep a few nights ago. |
e232f73
to
b06b469
Compare
b06b469
to
7a7f01c
Compare
LexicalError
type by usingBox<str>
overString
Tok
size by usingBox<str>
overString
.Using
Box<str>
is sufficient for us because we don't want to mutate the error message or token value.The downside of this is that using
Box<str>
is slightly more annoying.Future: It would be interesting to change the Lexer signature always to return a
Tok::Invalid
and write the errors to aVec
instead. This should allow for drastically reducing the size ofTok
andSpanned.