You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2025/05/27 18:10:31 UTC
[I] Reduce size of `Expr` struct [datafusion]
alamb opened a new issue, #16199:
URL: https://github.com/apache/datafusion/issues/16199
### Is your feature request related to a problem or challenge?
For unrelated reasons, I reduced the size of `Expr` from `272` to `112` bytes in this PR:
- https://github.com/apache/datafusion/pull/14366
It turns out this change resulted in a a pretty significant (10-20% faster) improvement in planning time https://github.com/apache/datafusion/pull/14366#issuecomment-2909160571:
```
group alamb_make_expr_smaller main
----- ----------------------- ----
physical_plan_clickbench_all 1.00 285.4±4.98ms ? ?/sec 1.14 324.2±6.52ms ? ?/sec
physical_plan_clickbench_q1 1.00 4.6±0.12ms ? ?/sec 1.10 5.0±0.13ms ? ?/sec
physical_plan_clickbench_q10 1.00 5.7±0.14ms ? ?/sec 1.16 6.5±0.42ms ? ?/sec
physical_plan_clickbench_q11 1.00 5.8±0.22ms ? ?/sec 1.13 6.6±0.21ms ? ?/sec
physical_plan_clickbench_q12 1.00 6.0±0.17ms ? ?/sec 1.12 6.7±0.24ms ? ?/sec
physical_plan_clickbench_q13 1.00 5.5±0.11ms ? ?/sec 1.12 6.1±0.17ms ? ?/sec
physical_plan_clickbench_q14 1.00 5.8±0.17ms ? ?/sec 1.12 6.5±0.15ms ? ?/sec
physical_plan_clickbench_q15 1.00 5.6±0.14ms ? ?/sec 1.13 6.3±0.18ms ? ?/sec
physical_plan_clickbench_q16 1.00 5.1±0.18ms ? ?/sec 1.09 5.5±0.19ms ? ?/sec
physical_plan_clickbench_q17 1.00 5.0±0.13ms ? ?/sec 1.14 5.8±0.15ms ? ?/sec
physical_plan_clickbench_q18 1.00 4.9±0.13ms ? ?/sec 1.12 5.4±0.15ms ? ?/sec
...
```
### Describe the solution you'd like
I would like to make a new PR that reduces the size of `Expr`
### Describe alternatives you've considered
I suggest
1. Change `Expr::WindowFunction(WindowFunction`) --> `Expr::WindowFunction(Box<WindowFunction>)` as described on https://github.com/apache/datafusion/pull/14366
2. Add a regression test for `Expr` size to ensure we don't get a regression again
### Additional context
I recommend:
1. Updating the Expr::WindowFunction definition
2. Letting the compiler guide you to code that needs to be updated and follow the pattern from https://github.com/apache/datafusion/pull/14366
3. Copy the tests from https://github.com/apache/datafusion/pull/14366
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "Omega359 (via GitHub)" <gi...@apache.org>.
Omega359 commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913982326
🤔
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "hendrikmakait (via GitHub)" <gi...@apache.org>.
hendrikmakait commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913568586
I'd love to take this one!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "Omega359 (via GitHub)" <gi...@apache.org>.
Omega359 commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913900526
I am surprised by the magnitude of the performance uptick by essentially moving something from the stack to the heap.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913646407
Thanks @hendrikmakait !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913491785
I think this is a good first issue because
1. there is an example / pattern to follow
2. There is evidence that this will make significant improvements
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "hendrikmakait (via GitHub)" <gi...@apache.org>.
hendrikmakait commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913583669
take
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb closed issue #16199: Reduce size of `Expr` struct
URL: https://github.com/apache/datafusion/issues/16199
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [I] Reduce size of `Expr` struct [datafusion]
Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on issue #16199:
URL: https://github.com/apache/datafusion/issues/16199#issuecomment-2913974924
> I am surprised by the magnitude of the performance uptick by essentially moving something from the stack to the heap.
My theory is that the performance difference is not the move to the heap but the fact that then all the places that make `Expr`s and copy them, etc have less work to do (as the Expr struct is half the size)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org