PERF/REGR: IntervalIndex.intersection, PeriodIndex.get_loc
- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry

Should fix #42240, #42247, not checking the box because I jumped the gun last time.