More speedups for Period comparisons
Following #21582, the biggest avoidable overheads in Period comparisons are in a) `isinstance` calls that can be short-circuited and b) `__ne__` call overhead.  This PR moves `__eq__` and `__ne__` to the cython file, removing the `__ne__` overhead, and changes an `isinstance` check to a try/except.

Using the same profile code from #21582, this brings the `set_index` runtime from 6.603 seconds down to 2.165 seconds.