Skip to content

Reduce size of Expr struct #16199

Closed
@alamb

Description

@alamb

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:

It turns out this change resulted in a a pretty significant (10-20% faster) improvement in planning time #14366 (comment):

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 Reduce size of Expr struct #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 Reduce size of Expr struct #14366
  3. Copy the tests from Reduce size of Expr struct #14366

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions