PERF: fix regression in tz_convert_from_utc
State: closed

- [x] closes #35803 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry - N/A I believe

Get rid of an unnecessary copy.

Labels:
name: Performance
description: Memory or execution speed performance
name: Timezones
description: Timezone data dtype

Comments:
Benchmark after:

```
[100.00%] ··· ========= ======================= ===================================================== ================================================== ========================================== =============
              --                                                                                                    tz                                                                                           
              --------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                 size    datetime.timezone.utc   datetime.timezone(datetime.timedelta(seconds=3600))   <DstTzInfo 'US/Pacific' LMT-1 day, 16:07:00 STD>   tzfile('/usr/share/zoneinfo/Asia/Tokyo')    tzlocal()  
              ========= ======================= ===================================================== ================================================== ========================================== =============
                  0           2.04±0.01μs                            2.03±0.02μs                                         2.08±0.02μs                                    2.14±0.05μs                  2.04±0.01μs 
                  1           2.06±0.01μs                            8.99±0.07μs                                          7.74±0.1μs                                    8.13±0.07μs                   47.7±0.3μs 
                 100          2.08±0.02μs                            8.99±0.03μs                                         8.79±0.03μs                                    8.70±0.06μs                  4.08±0.04ms 
                10000         3.83±0.06μs                             17.5±0.8μs                                           108±2μs                                       73.7±0.7μs                    404±2ms   
               1000000        1.93±0.03ms                             5.75±0.7ms                                          19.9±0.3ms                                      16.6±1ms                     463±8ns   
              ========= ======================= ===================================================== ================================================== ========================================== =============
```
Benchmark on master:
```
[100.00%] ··· ========= ======================= ===================================================== ================================================== ========================================== =============
              --                                                                                                    tz                                                                                           
              --------- -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                 size    datetime.timezone.utc   datetime.timezone(datetime.timedelta(seconds=3600))   <DstTzInfo 'US/Pacific' LMT-1 day, 16:07:00 STD>   tzfile('/usr/share/zoneinfo/Asia/Tokyo')    tzlocal()  
              ========= ======================= ===================================================== ================================================== ========================================== =============
                  0           2.12±0.06μs                            2.07±0.03μs                                         2.06±0.01μs                                    2.09±0.01μs                  2.02±0.02μs 
                  1           2.10±0.06μs                             8.82±0.2μs                                         7.81±0.07μs                                    8.06±0.07μs                   47.2±0.2μs 
                 100          2.09±0.04μs                             8.98±0.2μs                                         8.88±0.03μs                                    8.79±0.06μs                  4.14±0.08ms 
                10000         3.86±0.04μs                             17.3±0.1μs                                          105±0.1μs                                      73.9±0.1μs                    396±3ms   
               1000000         2.45±0.4ms                             5.58±0.9ms                                          18.8±0.5ms                                     15.5±0.4ms                    437±6ns   
              ========= ======================= ===================================================== ================================================== ========================================== =============
```
lgtm ping on green.

cc @jbrockmendel 
it isn't obvious to me that the copy is unnecessary
> it isn't obvious to me that the copy is unnecessary

The private method (where the copy is removed), is only called from `tz_convert_from_utc` just above (python wrapper of the cdef function), and this does a `np.array(converted, dtype=np.int64)`, which will ensure the result is copied anyway. 

So I think removing the copy in the private method is fine (it was also like this before)
makes sense, thanks
thanks @lidavidm