[PyTorch] Compare pointers before calling expensive Type comparison (#64784)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64784
See code comment for explanation.
ghstack-source-id: 138304431
Test Plan: Reduced overhead in findSchemaDifferences while profiling registration at startup in a case where I forced duplicates to be registered (by looping in RegisterDispatchKey.cpp).
Reviewed By: dhruvbird
Differential Revision: D30854036
fbshipit-source-id: 568733c3cf449697cdeb74cf57fed0926729fa68