PERF: large perf regression in DataFrame repr
On master:

```
In [1]: df = pd.DataFrame(np.random.randn(1_000_000, 10))

In [3]: %timeit repr(df) 
2.5 s ± 340 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
```

while on released version this takes around 20ms

cc @ivanovmg I suppose this is from https://github.com/pandas-dev/pandas/pull/36434