PERF: Calling slowpath for every group in transform
Code in `groupby.generic.DataFrameGroupBy._transform_general`:

https://github.com/pandas-dev/pandas/blob/b3e335254f46a526ee3ce9bb757eac4011d9d1fe/pandas/core/groupby/generic.py#L1299-L1309

This is calling `_choose_path` for every group, which in turn calls both the slow_path and the fast_path to determine if the fast path can be used. Indeed, running the code (from #41584):

```
df = pd.DataFrame({
    'x': ['a', 'b', 'c', 'd'],
    'y': [5, 6, 7, 8],
    'g': [1, 2, 3, 3]
})
def myfirst(c):
    return c.iloc[0]
print(df.groupby('g').transform(myfirst))
```

shows `myfirst` gets called 9 times - 3 times with columns x, 3 times with column y, and three times with the DataFrame consisting of x and y.

Should we just be calling choose_path on the first group to determine which can be used?

cc @phofl @jbrockmendel 

