25708 performance degradation when dumping large dataframe with datetime to csv
- [x] closes #25708
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry
Slicing in [line 2181](https://github.com/pandas-dev/pandas/blob/707c7201a744c48c835f719421e47480beee2184/pandas/core/internals/blocks.py#L2181) only slice of `i8values` that make a whole of `values` array is processed in `_is_dates_only` function.
This change was from  pull #24543
```python
        values = self.values
        i8values = self.values.view('i8')

        if slicer is not None:
            i8values = i8values[..., slicer]

        from pandas.io.formats.format import _get_format_datetime64_from_values
        fmt = _get_format_datetime64_from_values(values, date_format)
```