PERF: 10x speedup in Series/DataFrame construction for lists of ints
State: closed

This PR is a minor tweak to the `int64`/`uint64` overflow fix added in https://github.com/pandas-dev/pandas/pull/18624 

Simply casting to an `int` after doing a typecheck is sufficient for the compiler to generate a 10x speedup:
```
$ asv compare upstream/master HEAD --sort ratio -s

Benchmarks that have improved:

       before           after         ratio
     [f074abef]       [80641ddf]
     <series_list_int_speedup~1>       <series_list_int_speedup>
           failed          7.39±0s      n/a  strings.Dummies.time_get_dummies
-        61.7±3ms       11.7±0.5ms     0.19  ctors.SeriesConstructors.time_series_constructor(<function arr_dict>, True, 'int')
-        63.0±2ms       11.1±0.3ms     0.18  ctors.SeriesConstructors.time_series_constructor(<function arr_dict>, False, 'int')
-        55.8±2ms       5.37±0.2ms     0.10  ctors.SeriesConstructors.time_series_constructor(<class 'list'>, True, 'int')
-        55.3±5ms       4.84±0.2ms     0.09  ctors.SeriesConstructors.time_series_constructor(<class 'list'>, False, 'int')
```
This is how `maybe_convert_numeric()` already handles `int`s, so this just brings `maybe_convert_object()` back into alignment.

I believe this would yield a similar speedup for `DataFrame`s but we don't have any benchmarks explicitly testing as such. However, the `get_dummies()` benchmark involves expanding to a `DataFrame` and gets a speedup of similar magnitude (not visible as it previously would time out after 30s).

- [ ] closes #xxxx
- [ ] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


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

Comments:
nice. ping on green.
actually there are a few more cases where the same fix could be applied
@jreback Just to clarify - the speedup comes from preventing an object-to-object comparison for `val > oUINT_MAX` and the like (which is avoided in `saw_int(int(val))` by casting the input). I think this is the only change needed for that precise case, but happy to implement any that I'm missing here.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=h1) Report
> Merging [#24647](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/280a88fdc99d867fbe91ac576184b288bcb49e09?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24647/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24647      +/-   ##
==========================================
- Coverage   92.37%   92.37%   -0.01%     
==========================================
  Files         166      166              
  Lines       52377    52380       +3     
==========================================
+ Hits        48385    48387       +2     
- Misses       3992     3993       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.79% <ø> (-0.01%)` | :arrow_down: |
| #single | `43.01% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.68% <0%> (-0.16%)` | :arrow_down: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `88.09% <0%> (-0.16%)` | :arrow_down: |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `98.52% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.52% <0%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.09% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=footer). Last update [280a88f...73865f1](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=h1) Report
> Merging [#24647](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/280a88fdc99d867fbe91ac576184b288bcb49e09?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24647/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24647      +/-   ##
==========================================
- Coverage   92.37%   92.37%   -0.01%     
==========================================
  Files         166      166              
  Lines       52377    52380       +3     
==========================================
+ Hits        48385    48387       +2     
- Misses       3992     3993       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.79% <ø> (-0.01%)` | :arrow_down: |
| #single | `43.01% <ø> (-0.01%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/arrays/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lcy5weQ==) | `97.68% <0%> (-0.16%)` | :arrow_down: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `88.09% <0%> (-0.16%)` | :arrow_down: |
| [pandas/core/arrays/period.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3BlcmlvZC5weQ==) | `98.52% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.52% <0%> (ø)` | :arrow_up: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24647/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88.09% <0%> (+0.09%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=footer). Last update [280a88f...73865f1](https://codecov.io/gh/pandas-dev/pandas/pull/24647?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

maybe this was the one I was looking at. ok, ping on green.
@jreback ping