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: Fix groupby skipna performance #60871

Merged
merged 1 commit into from
Feb 10, 2025
Merged

Conversation

snitish
Copy link
Contributor

@snitish snitish commented Feb 6, 2025

@snitish snitish requested a review from WillAyd as a code owner February 6, 2025 23:33
@snitish
Copy link
Contributor Author

snitish commented Feb 7, 2025

| Change   | Before [3979e954] <main>   | After [22245da4] <issue60870>   | Ratio   | Benchmark (Parameter)                                                |
|----------|----------------------------|---------------------------------|---------|----------------------------------------------------------------------|
|          | 30.1±1ms                   | 30.2±0.8ms                      | 1.00    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'all')            |
|          | 31.6±1ms                   | 31.7±0.3ms                      | 1.00    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'any')            |
|          | 21.2±0.5ms                 | 22.0±0.3ms                      | 1.04    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'first')          |
|          | 24.1±0.3ms                 | 22.3±0.5ms                      | 0.92    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'idxmax')         |
|          | 22.1±0.2ms                 | 21.7±0.3ms                      | 0.98    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'idxmin')         |
|          | 20.5±0.4ms                 | 21.7±0.3ms                      | 1.06    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'last')           |
|          | 24.2±0.6ms                 | 22.5±3ms                        | 0.93    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'max')            |
| -        | 29.9±0.4ms                 | 26.8±0.3ms                      | 0.90    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'mean')           |
|          | 138±1ms                    | 139±3ms                         | 1.01    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'median')         |
|          | 23.9±0.5ms                 | 20.9±1ms                        | ~0.87   | groupby.GroupByCythonAgg.time_frame_agg('float64', 'min')            |
|          | 21.5±0.6ms                 | 18.9±1ms                        | ~0.88   | groupby.GroupByCythonAgg.time_frame_agg('float64', 'prod')           |
|          | 31.8±3ms                   | 25.8±1ms                        | ~0.81   | groupby.GroupByCythonAgg.time_frame_agg('float64', 'sum')            |
| -        | 33.0±0.8ms                 | 28.5±0.3ms                      | 0.86    | groupby.GroupByCythonAgg.time_frame_agg('float64', 'var')            |
|          | 35.3±0.3ms                 | 34.7±0.2ms                      | 0.98    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'all')    |
|          | 38.1±0.4ms                 | 38.0±0.4ms                      | 1.00    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'any')    |
|          | 33.7±0.3ms                 | 34.8±0.8ms                      | 1.03    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'first')  |
|          | 36.3±0.3ms                 | 36.3±0.3ms                      | 1.00    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'last')   |
| -        | 35.4±0.3ms                 | 31.8±0.3ms                      | 0.90    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'max')    |
| -        | 46.0±1ms                   | 41.4±0.4ms                      | 0.90    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'mean')   |
|          | 200±6ms                    | 197±3ms                         | 0.98    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'median') |
| -        | 35.0±0.9ms                 | 31.3±0.8ms                      | 0.90    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'min')    |
|          | 34.2±0.6ms                 | 35.8±0.9ms                      | 1.05    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'prod')   |
|          | 45.6±0.5ms                 | 44.1±0.5ms                      | 0.97    | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'sum')    |
|          | 51.4±0.5ms                 | 46.2±1ms                        | ~0.90   | groupby.GroupByCythonAggEaDtypes.time_frame_agg('Float64', 'var')    |

cc: @rhshadrach

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

lgtm, merging main should get the CI green.

@mroeschke mroeschke added Groupby Performance Memory or execution speed performance labels Feb 10, 2025
@mroeschke mroeschke added this to the 3.0 milestone Feb 10, 2025
@mroeschke mroeschke merged commit 11e3dc2 into pandas-dev:main Feb 10, 2025
39 of 48 checks passed
@mroeschke
Copy link
Member

Thanks @snitish

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Groupby Performance Memory or execution speed performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: Regression in groupby ops from adding skipna
3 participants