CLN: replace lambdas with named functions so they are labeled in asv
State: closed

This complements a PR in `asv` (https://github.com/airspeed-velocity/asv/pull/771), but would be worthwhile on its own.

`asv` compares benchmarks based on the `repr()` of the parameters, which causes issues when the parameter is an object that doesn't override the default `repr()` (such as functions, especially lambda functions):
```
Benchmarks that have stayed the same:

       before           after         ratio
     [24ab22f7]       [d7cef344]
              n/a          997±3μs      n/a  ctors.SeriesConstructors.time_series_constructor(<function SeriesConstructors.<lambda> at 0x7f0deb0800d0>, False)
              n/a         1.05±0ms      n/a  ctors.SeriesConstructors.time_series_constructor(<function SeriesConstructors.<lambda> at 0x7f0deb0800d0>, True)
      1.04±0.01ms              n/a      n/a  ctors.SeriesConstructors.time_series_constructor(<function SeriesConstructors.<lambda> at 0x7fd9d0bbc598>, False)
      1.06±0.02ms              n/a      n/a  ctors.SeriesConstructors.time_series_constructor(<function SeriesConstructors.<lambda> at 0x7fd9d0bbc598>, True)
```
As the memory address component of the name changes between runs, `asv` fails at lining up the comparison. This has to be fixed upstream.

However, passing `lambda` functions is particularly unhelpful, as we have no idea which of the six such objects are represented in the example above.

This PR simply gives each function a descriptive name:
```
asv continuous -b SeriesConstructors v0.20.0..HEAD
[...]
[ 50.00%] · For pandas commit 20c2a780 <asv_change> (round 2/2):
[ 50.00%] ·· Benchmarking conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
[ 75.00%] ··· ctors.SeriesConstructors.time_series_constructor                                                                                                                                                   ok
[ 75.00%] ··· ======================================================= ============= =============
              --                                                               with_index        
              ------------------------------------------------------- ---------------------------
                                      data_fmt                            False          True    
              ======================================================= ============= =============
                       <function no_change at 0x7efcd7b67c80>           74.0±0.4μs     131±3μs   
                                        list                           1.15±0.03ms   1.20±0.01ms 
                      <function list_of_str at 0x7efcd7b67d08>           688±9μs       741±6μs   
                       <function arr_dict at 0x7efcd7b67b70>           4.49±0.01ms   4.71±0.02ms 
                    <function list_of_tuples at 0x7efcd7b679d8>        1.02±0.01ms   1.10±0.01ms 
                     <function list_of_lists at 0x7efcd7b67a60>        1.04±0.03ms   1.09±0.04ms 
               <function list_of_tuples_with_none at 0x7efcd7b67ae8>   1.02±0.02ms   1.08±0.02ms 
                <function list_of_lists_with_none at 0x7efcd7b676a8>   1.05±0.01ms   1.10±0.01ms 
              ======================================================= ============= =============

[ 75.00%] · For pandas commit 91753873 <maybe_convert_objects_int_overflow_fix~1> (round 2/2):
[ 75.00%] ·· Building for conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt.....
[ 75.00%] ·· Benchmarking conda-py3.6-Cython-matplotlib-numexpr-numpy-openpyxl-pytables-pytest-scipy-sqlalchemy-xlrd-xlsxwriter-xlwt
[100.00%] ··· ctors.SeriesConstructors.time_series_constructor                                                                                                                                                   ok
[100.00%] ··· ======================================================= ============= =============
              --                                                               with_index        
              ------------------------------------------------------- ---------------------------
                                      data_fmt                            False          True    
              ======================================================= ============= =============
                       <function no_change at 0x7efcd7b67c80>           72.9±0.9μs     126±1μs   
                                        list                             1.10±0ms    1.16±0.02ms 
                      <function list_of_str at 0x7efcd7b67d08>           699±10μs      760±3μs   
                       <function arr_dict at 0x7efcd7b67b70>           4.54±0.08ms   4.71±0.04ms 
                    <function list_of_tuples at 0x7efcd7b679d8>        1.01±0.01ms   1.08±0.02ms 
                     <function list_of_lists at 0x7efcd7b67a60>        1.01±0.01ms   1.07±0.01ms 
               <function list_of_tuples_with_none at 0x7efcd7b67ae8>   1.02±0.01ms   1.09±0.02ms 
                <function list_of_lists_with_none at 0x7efcd7b676a8>     1.05±0ms    1.08±0.01ms 
              ======================================================= ============= =============


BENCHMARKS NOT SIGNIFICANTLY CHANGED.
```

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Benchmark
description: Performance (ASV) benchmarks

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24629?src=pr&el=h1) Report
> Merging [#24629](https://codecov.io/gh/pandas-dev/pandas/pull/24629?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/cb31b2b0912c99e40b22a26e598e640548ea8f14?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/24629/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24629?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24629      +/-   ##
==========================================
- Coverage   92.38%   92.37%   -0.01%     
==========================================
  Files         166      166              
  Lines       52395    52395              
==========================================
- Hits        48403    48402       -1     
- Misses       3992     3993       +1
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.8% <ø> (ø)` | :arrow_up: |
| #single | `43% <ø> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24629?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/24629/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `88% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24629?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/24629?src=pr&el=footer). Last update [cb31b2b...ff15bae](https://codecov.io/gh/pandas-dev/pandas/pull/24629?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/24629?src=pr&el=h1) Report
> Merging [#24629](https://codecov.io/gh/pandas-dev/pandas/pull/24629?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/cb31b2b0912c99e40b22a26e598e640548ea8f14?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master   #24629   +/-   ##
=======================================
  Coverage   92.38%   92.38%           
=======================================
  Files         166      166           
  Lines       52395    52395           
=======================================
  Hits        48403    48403           
  Misses       3992     3992
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.8% <ø> (ø)` | :arrow_up: |
| #single | `43% <ø> (ø)` | :arrow_up: |


------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24629?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/24629?src=pr&el=footer). Last update [cb31b2b...681518d](https://codecov.io/gh/pandas-dev/pandas/pull/24629?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks!