ENH: Do unique check before computing indexer in reindex
- [x] closes #51287 (Replace xxxx with the GitHub issue number)
- [ ] [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.

Looks good. Could use a performance whatsnew note  I'd feel a bit weird advertising that we are raising the error faster now :) But ok to add, if you feel strongly about it Guess that's fair. Thanks @phofl  Hello, @phofl @mroeschke  I was wondering if this pull request has been backported? According to the [backporting guidelines](https://pandas.pydata.org/docs/development/maintaining.html#backporting), it seems that PRs with a milestone should be backported. However, I couldn't find a corresponding backport PR linked to this one. Can you please clarify if a backport has been created or if there's a different situation here?  This pr was released in 2.0, which is what the milestone tells you. 

You’ll have to clarify your question. To which branch should we have backported this pr? Thank you for your response! 

Sorry for any confusion earlier, I'm not familiar with the open-source management mechanisms on GitHub. I took another look at the documentation and realized indeed when a milestone corresponds to the master version, a backport isn't necessary. 

My question is actually about the process of fixing bugs: when you address a bug, do you first fix it in the master version and then backport that fix to the milestone, which is the target version? Does this mean that other versions won't receive the fix? For example, if the master is at 2.0 and the milestone is set for 1.3.x, does that mean only these two versions will be corrected on GitHub, and other minor versions, such as 1.4.x, 1.5.x, won't be fixed? Additionally, regarding PyPI releases, if a version on GitHub is backported, will the content in the PyPI package be updated with the fix? pandas only maintains 2 branches during active development: The main branch which reflects the next upcoming minor/major release, e.g. 3.0, and the latest minor release branch, e.g. 2.2.x. A backported PR will apply to main and the latest minor release branch. The latest minor release branch usually only gets 3 or 4 packages on PyPI and conda e.g. 2.2.1, 2.2.2,  2.2.3.
 Thank you for your response! Now I get it.