PERF: short-circuit allocations in infer_dtype, ensure_datetime64ns
State: closed

```
from pandas._libs.tslibs.conversion import *

arr = np.arange(10**6).view("M8[ns]")

%timeit ensure_datetime64ns(arr, copy=False)
423 ns ± 10.3 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)  # <- PR
3.5 µs ± 17.3 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)  # <- master

%timeit ensure_datetime64ns(arr, copy=True)
517 µs ± 11.4 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)   # <- PR
1.77 ms ± 4.44 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)  # <- master


from pandas._libs.lib import *

farr = np.arange(10**6)[::2]

%timeit infer_dtype(farr, skipna=True)
2.94 µs ± 48.2 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)  # <- PR
412 µs ± 34.4 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)  # <- master
```

Labels:
name: Performance
description: Memory or execution speed performance

Comments:
``` 
  File "pandas/_libs/tslibs/tzconversion.pyx", line 554, in pandas._libs.tslibs.tzconversion._tzlocal_get_offset_components
    dt = dt.astimezone(tz)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/_common.py", line 144, in fromutc
    return f(self, dt)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/_common.py", line 261, in fromutc
    _fold = self._fold_status(dt, dt_wall)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/_common.py", line 196, in _fold_status
    if self.is_ambiguous(dt_wall):
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/tz.py", line 254, in is_ambiguous
    naive_dst = self._naive_is_dst(dt)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/tz.py", line 260, in _naive_is_dst
    return time.localtime(timestamp + time.timezone).tm_isdst
OverflowError: timestamp out of range for platform time_t
##[warning]Exception ignored in: 'pandas._libs.tslibs.conversion._localize_tso'

Traceback (most recent call last):
  File "pandas/_libs/tslibs/tzconversion.pyx", line 383, in pandas._libs.tslibs.tzconversion.tz_convert_utc_to_tzlocal
    return _tz_convert_tzlocal_utc(utc_val, tz, to_utc=False, fold=fold)
  File "pandas/_libs/tslibs/tzconversion.pyx", line 594, in pandas._libs.tslibs.tzconversion._tz_convert_tzlocal_utc
    delta = _tzlocal_get_offset_components(val, tz, to_utc, fold)
  File "pandas/_libs/tslibs/tzconversion.pyx", line 554, in pandas._libs.tslibs.tzconversion._tzlocal_get_offset_components
    dt = dt.astimezone(tz)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/_common.py", line 144, in fromutc
    return f(self, dt)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/_common.py", line 261, in fromutc
    _fold = self._fold_status(dt, dt_wall)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/_common.py", line 196, in _fold_status
    if self.is_ambiguous(dt_wall):
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/tz.py", line 254, in is_ambiguous
    naive_dst = self._naive_is_dst(dt)
  File "/root/virtualenvs/pandas-dev/lib/python3.8/site-packages/dateutil/tz/tz.py", line 260, in _naive_is_dst
    return time.localtime(timestamp + time.timezone).tm_isdst
OverflowError: timestamp out of range for platform time_t
```


looks legit (32-bit build)
> looks legit (32-bit build)

those show up in the logs pretty frequently but don't cause failures.  i'll wait until the other CI issues are resolved to re-push and see if its an actual problem here