PERF: Fix groupby skipna performance
State: closed

- [ ] closes #60870
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Groupby
name: Performance
description: Memory or execution speed performance

Comments:
```
| 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 
Thanks @snitish