-
Notifications
You must be signed in to change notification settings - Fork 250
refactor: unpack & try_unpack
#2532
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
Conversation
| "std.mul" => Some(Multiply), | ||
| "std.div" => Some(Divide), | ||
| "std.mod" => Some(Modulo), | ||
| "std.add" => Some(Plus), | ||
| "std.sub" => Some(Minus), | ||
| "std.eq" => Some(Eq), | ||
| "std.ne" => Some(NotEq), | ||
| "std.gt" => Some(Gt), | ||
| "std.lt" => Some(Lt), | ||
| "std.gte" => Some(GtEq), | ||
| "std.lte" => Some(LtEq), | ||
| "std.and" => Some(And), | ||
| "std.or" => Some(Or), | ||
| "std.concat" => Some(StringConcat), |
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.
Ideally, this would use std::STD_X so we have it "linked" with RQ.
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.
Yes, I left some notes here, I agree the current state isn't ideal. I'm not sure how much we want to have these deep in the compiler with something like an Enum...
aljazerzen
left a comment
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.
This is way better, as in way more readable.
I went too deep with the no-clone frenzy :D It's actually slower probably because it was searching for impl of functions in linear search. This PR is now using sub-logarithmic lookups (because it's using match).
OK great! Thanks for being open. I was holding that it was "worse but easier rust" — maybe it's actually / actually much worse. I do think this sort of change can make it easier for others to contribute... I'll update to yesterday's regex addition, resolve hte comments, and leave a couple of notes re strings vs |
|
...and using slice patterns reduces some of the |
|
I'll merge given your ✅ , but happy to do follow-up with any other changes |
As I mentioned on Discord. Inspired by this discussion
.clone()cargo bench, about 3% on my machinetry_into_*before doing the next one if that failsregexfrom todayGPT-4 helped me a lot!
if args.len() == Xin lots of places, and could have these as structs & enums in rust, though I'm not sure how deep in the compiler we want them (maybe there's a difference between functions & operators?)