Skip to content
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

perf: Avoid allocating a String for each formatted operator #4721

Merged
merged 2 commits into from
May 10, 2022

Conversation

Marwes
Copy link
Contributor

@Marwes Marwes commented May 9, 2022

Refactors the parse/display of operators to use a common macro which removes duplication
and ensures that we cover all variants. I changed ToString for LogicalOperator to a fmt::Display
implementation as there is a default implementation that auto implements ToString (ToString for T where T: fmt::Display).

cc #4712

Refactors the parse/display of operators to use a common macro which removes duplication
and ensures that we cover all variants. I changed `ToString for LogicalOperator` to a `fmt::Display`
implementation as there is a default implementation that auto implements `ToString` (`ToString for T where T: fmt::Display`).
@Marwes Marwes requested a review from onelson May 9, 2022 17:15
@Marwes Marwes requested a review from a team as a code owner May 9, 2022 17:15
Copy link
Contributor

@onelson onelson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A much cleaner implementation than I had in my POC 😅
The macro really helps!

Not sure how much of a savings this really is, but the allocations we were doing did seem needless.

@Marwes
Copy link
Contributor Author

Marwes commented May 10, 2022

Yeah, this won't do anything to fix the issue itself, it just removes some unnecessary work.

@Marwes Marwes merged commit 18f3d8e into master May 10, 2022
@Marwes Marwes deleted the format_alloc branch May 10, 2022 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants