34297 sub slow in first call
- [x] closes #34297
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

@jbrockmendel 

I added a lenght check as suggested by you. I could not find another method to check the indices (nlevels for example does not work). I'm open to recommendations about adding additional checks before running into the values call.

I have added a test, which measures the execution time of both calls to `sub`. Is there a better way to test, if they are equally fast?