PERF/CLN: to_csv
- [ ] xref #41468
- [ ] tests added / passed
- [ ] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [ ] whatsnew entry

More of a cleanup than a performance improvement. Perf only seems to improve for multiindexes.
Will try to squeeze out more improvement.

Here are the asv's (run 3 times)
```
asv continuous -f 1.1 upstream/master HEAD -b ^io.csv.ToCSV
```
```
       before           after         ratio
     [5153334c]       [a7a839bd]
     <perf-to-csv~2^2>       <perf-to-csv>
-        28.3±5ms       13.6±0.8ms     0.48  io.csv.ToCSVDatetime.time_frame_date_formatting
-       2.77±0.1s       1.10±0.01s     0.40  io.csv.ToCSVIndexes.time_head_of_multiindex

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

       before           after         ratio
     [5153334c]       [a7a839bd]
     <perf-to-csv~2^2>       <perf-to-csv>
-        29.8±6ms       15.9±0.3ms     0.53  io.csv.ToCSVDatetime.time_frame_date_formatting
-       2.51±0.2s       1.25±0.06s     0.50  io.csv.ToCSVIndexes.time_head_of_multiindex

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

       before           after         ratio
     [5153334c]       [a7a839bd]
     <perf-to-csv~2^2>       <perf-to-csv>
-        934±30ms         767±30ms     0.82  io.csv.ToCSVIndexes.time_multiindex
-      3.49±0.08s       1.08±0.03s     0.31  io.csv.ToCSVIndexes.time_head_of_multiindex

SOME BENCHMARKS HAVE CHANGED SIGNIFICANTLY.
PERFORMANCE INCREASED.

```

@lithomas1 can you merge master and run the memory asvs This pull request is stale because it has been open for thirty days with no activity. Please update or respond to this comment if you're still interested in working on this. This PR has appear to have gone stale. Closing for now, but feel free to reopen if you're still interested in working on this.