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(es/ast): Shrink only large variants #7040

Closed
wants to merge 11 commits into from
Closed

Conversation

kdy1
Copy link
Member

@kdy1 kdy1 commented Mar 9, 2023

Description:

This PR shrinks large variants of Expr and Stmt to make them into a cache line.

Related issue:


cc @dsherret thank you for the idea!

This looks better than #7034

@kdy1 kdy1 added this to the Planned milestone Mar 9, 2023
@kdy1 kdy1 self-assigned this Mar 9, 2023
@@ -89,7 +89,7 @@ pub enum Stmt {
ForIn(ForInStmt),
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a _assert_size() for Stmt to prevent regressions?

@kdy1
Copy link
Member Author

kdy1 commented Mar 9, 2023

Performance of minifier regressed.


Gnuplot not found, using plotters backend
Benchmarking es/minify/libraries/antd
Benchmarking es/minify/libraries/antd: Warming up for 3.0000 s

Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 6.1s.
Benchmarking es/minify/libraries/antd: Collecting 10 samples in estimated 6.1066 s (10 iterations)
Benchmarking es/minify/libraries/antd: Analyzing
es/minify/libraries/antd
                        time:   [616.28 ms 623.19 ms 631.97 ms]
                        change: [+0.4114% +1.7821% +3.2218%] (p = 0.03 < 0.05)
                        Change within noise threshold.
Found 2 outliers among 10 measurements (20.00%)
  1 (10.00%) high mild
  1 (10.00%) high severe
Benchmarking es/minify/libraries/d3
Benchmarking es/minify/libraries/d3: Warming up for 3.0000 s

Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 8.6s or enable flat sampling.
Benchmarking es/minify/libraries/d3: Collecting 10 samples in estimated 8.6197 s (55 iterations)
Benchmarking es/minify/libraries/d3: Analyzing
es/minify/libraries/d3  time:   [149.94 ms 155.88 ms 161.44 ms]
                        change: [+1.7653% +4.7425% +7.8320%] (p = 0.01 < 0.05)
                        Performance has regressed.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) high mild
Benchmarking es/minify/libraries/echarts
Benchmarking es/minify/libraries/echarts: Warming up for 3.0000 s

Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 5.2s.
Benchmarking es/minify/libraries/echarts: Collecting 10 samples in estimated 5.1540 s (10 iterations)
Benchmarking es/minify/libraries/echarts: Analyzing
es/minify/libraries/echarts
                        time:   [519.29 ms 526.54 ms 534.37 ms]
                        change: [+2.0968% +3.7043% +5.6038%] (p = 0.00 < 0.05)
                        Performance has regressed.
Benchmarking es/minify/libraries/jquery
Benchmarking es/minify/libraries/jquery: Warming up for 3.0000 s
Benchmarking es/minify/libraries/jquery: Collecting 10 samples in estimated 5.3195 s (110 iterations)
Benchmarking es/minify/libraries/jquery: Analyzing
es/minify/libraries/jquery
                        time:   [47.953 ms 49.561 ms 50.790 ms]
                        change: [+2.8161% +4.8174% +7.5943%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 2 outliers among 10 measurements (20.00%)
  2 (20.00%) high mild
Benchmarking es/minify/libraries/lodash
Benchmarking es/minify/libraries/lodash: Warming up for 3.0000 s
Benchmarking es/minify/libraries/lodash: Collecting 10 samples in estimated 6.5195 s (110 iterations)
Benchmarking es/minify/libraries/lodash: Analyzing
es/minify/libraries/lodash
                        time:   [59.541 ms 61.389 ms 62.485 ms]
                        change: [-0.8934% +2.1645% +5.1785%] (p = 0.20 > 0.05)
                        No change in performance detected.
Benchmarking es/minify/libraries/moment
Benchmarking es/minify/libraries/moment: Warming up for 3.0000 s
Benchmarking es/minify/libraries/moment: Collecting 10 samples in estimated 6.4693 s (220 iterations)
Benchmarking es/minify/libraries/moment: Analyzing
es/minify/libraries/moment
                        time:   [29.045 ms 30.017 ms 31.131 ms]
                        change: [+2.5371% +4.7362% +7.8716%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 2 outliers among 10 measurements (20.00%)
  1 (10.00%) high mild
  1 (10.00%) high severe
Benchmarking es/minify/libraries/react
Benchmarking es/minify/libraries/react: Warming up for 3.0000 s
Benchmarking es/minify/libraries/react: Collecting 10 samples in estimated 5.2953 s (495 iterations)
Benchmarking es/minify/libraries/react: Analyzing
es/minify/libraries/react
                        time:   [10.503 ms 10.776 ms 11.139 ms]
                        change: [+2.7551% +5.2351% +7.7457%] (p = 0.00 < 0.05)
                        Performance has regressed.
Benchmarking es/minify/libraries/terser
Benchmarking es/minify/libraries/terser: Warming up for 3.0000 s

Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 6.8s or enable flat sampling.
Benchmarking es/minify/libraries/terser: Collecting 10 samples in estimated 6.8213 s (55 iterations)
Benchmarking es/minify/libraries/terser: Analyzing
es/minify/libraries/terser
                        time:   [124.46 ms 125.98 ms 127.95 ms]
                        change: [+1.8157% +4.3650% +6.2808%] (p = 0.00 < 0.05)
                        Performance has regressed.
Benchmarking es/minify/libraries/three
Benchmarking es/minify/libraries/three: Warming up for 3.0000 s
Benchmarking es/minify/libraries/three: Collecting 10 samples in estimated 6.0177 s (30 iterations)
Benchmarking es/minify/libraries/three: Analyzing
es/minify/libraries/three
                        time:   [199.79 ms 203.12 ms 206.98 ms]
                        change: [+1.2901% +3.7232% +6.2701%] (p = 0.01 < 0.05)
                        Performance has regressed.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) high mild
Benchmarking es/minify/libraries/typescript
Benchmarking es/minify/libraries/typescript: Warming up for 3.0000 s

Warning: Unable to complete 10 samples in 5.0s. You may wish to increase target time to 11.5s.
Benchmarking es/minify/libraries/typescript: Collecting 10 samples in estimated 11.483 s (10 iterations)
Benchmarking es/minify/libraries/typescript: Analyzing
es/minify/libraries/typescript
                        time:   [1.1463 s 1.1602 s 1.1747 s]
                        change: [-2.8650% -1.3591% +0.0918%] (p = 0.11 > 0.05)
                        No change in performance detected.
Benchmarking es/minify/libraries/victory
Benchmarking es/minify/libraries/victory: Warming up for 3.0000 s
Benchmarking es/minify/libraries/victory: Collecting 10 samples in estimated 5.8619 s (20 iterations)
Benchmarking es/minify/libraries/victory: Analyzing
es/minify/libraries/victory
                        time:   [288.94 ms 293.17 ms 299.63 ms]
                        change: [+0.8371% +3.6435% +6.4265%] (p = 0.02 < 0.05)
                        Change within noise threshold.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) high severe
Benchmarking es/minify/libraries/vue
Benchmarking es/minify/libraries/vue: Warming up for 3.0000 s
Benchmarking es/minify/libraries/vue: Collecting 10 samples in estimated 7.8759 s (110 iterations)
Benchmarking es/minify/libraries/vue: Analyzing
es/minify/libraries/vue time:   [70.593 ms 71.783 ms 72.953 ms]
                        change: [+0.0466% +2.9570% +5.5413%] (p = 0.06 > 0.05)
                        No change in performance detected.
Found 1 outliers among 10 measurements (10.00%)
  1 (10.00%) high mild

@kdy1
Copy link
Member Author

kdy1 commented Mar 9, 2023

Closing as this regresses performance (and it's expected)

@kdy1 kdy1 closed this Mar 9, 2023
@kdy1 kdy1 deleted the box-try-2 branch March 9, 2023 08:24
@kdy1 kdy1 restored the box-try-2 branch March 9, 2023 08:35
@kdy1 kdy1 reopened this Mar 9, 2023
@kdy1
Copy link
Member Author

kdy1 commented Mar 9, 2023

Closing in favor of #7041

@kdy1 kdy1 closed this Mar 9, 2023
@kdy1 kdy1 deleted the box-try-2 branch March 9, 2023 13:18
@kdy1 kdy1 modified the milestones: Planned, v1.3.39 Mar 10, 2023
@swc-project swc-project locked as resolved and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

perf(ast): shrink large struct sizes
2 participants