-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Reduce size of Expr
struct
#16207
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 size of Expr
struct
#16207
Conversation
@@ -330,7 +331,7 @@ pub enum Expr { | |||
/// [`ExprFunctionExt`]: crate::expr_fn::ExprFunctionExt | |||
AggregateFunction(AggregateFunction), | |||
/// Call a window function with a set of arguments. | |||
WindowFunction(WindowFunction), | |||
WindowFunction(Box<WindowFunction>), |
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.
I wonder, what is now 144 bytes?
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.
Good question! I'm fairly new to Rust; what's a good way to analyze the enum variant sizes?
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.
It looks like Alias
might be the culprit here (with some padding):
size_of::<Alias>()
is 136, followed by size_of::<(DataType, Column)>()
(alias OuterReferenceColumn
) with 128.
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.
Maybe as a follow on experiment we can try to box Alias and OuterReferenceColumn too -- but I recommend not in this PR
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.
Agree - although it seems the size of the changes will be lower than 272 to 144 (I hoped maybe there would be a single one to reduce it from 144 -> 80).
Thanks for checking!
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.
Turns out I was doing something else and got the size down to 128
:
Hopefully this will merge in a bit
🤖 |
I kicked off some benchmarks for this PR -- thank you @hendrikmakait 🙏 |
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.
Thank you so much @hendrikmakait and @Dandandan
Assuming the benchmarks look good I think we should merge this PR.
Here is hoping for some improved performance: 🙏
🤖: Benchmark completed Details
|
🤖 |
🤖: Benchmark completed Details
|
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.
The planning benchmarks look really good to me. Thanks again @hendrikmakait
I'll leave this open for a few days to gather any remaining feedback |
I plan to merge this tomorrow so it can be included in DataFusion 48.0.0 |
🚀 -- thanks again @hendrikmakait |
Which issue does this PR close?
Expr
struct #16199.What changes are included in this PR?
Expr
Expr::WindowFunction(WindowFunction)
-->Expr::WindowFunction(Box<WindowFunction>)
-- which drops the size ofExpr
from 272 to 144 bytesAre these changes tested?
Are there any user-facing changes?
No