PERF: Add asv benchmarks for select_dtypes (14588)
State: closed

- [x] closes #14588 
- [x] tests added / passed
- [x] passes `black pandas`
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry


Labels:
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Benchmark
description: Performance (ASV) benchmarks

Comments:
can you show a run of these new benchmarks
`asv dev -b dtypes.SelectDtypes` gives the following output.
<details>
· Discovering benchmarks
· Running 8 total benchmarks (1 commits * 1 environments * 8 benchmarks)
[  0.00%] ·· Benchmarking existing-py_Users_avinash_anaconda3_envs_pandas-dev_bin_python3.8
[  6.25%] ··· Running (dtypes.SelectDtypes.time_select_dtype_bool_exclude--)..
[ 18.75%] ··· Running (dtypes.SelectDtypes.time_select_dtype_float_exclude--)..
[ 31.25%] ··· Running (dtypes.SelectDtypes.time_select_dtype_int_exclude--)..
[ 43.75%] ··· Running (dtypes.SelectDtypes.time_select_dtype_string_exclude--)..
[ 56.25%] ··· dtypes.SelectDtypes.time_select_dtype_bool_exclude                                                            ok
[ 56.25%] ··· ================= ==========
                    dtype
              ----------------- ----------
                    uint8        829±20μs
                    uint16       817±4μs
                    uint32       831±20μs
                    uint64       836±9μs
                     int         808±10μs
                     int8        827±20μs
                    int16        815±9μs
                    int32        832±20μs
                    int64        830±20μs
                    UInt8        809±10μs
                    UInt16       813±10μs
                    UInt32       813±10μs
                    UInt64       804±10μs
                     Int8        823±10μs
                    Int16        816±3μs
                    Int32        801±10μs
                    Int64        818±10μs
                    float        817±10μs
                   float32       809±10μs
                   float64       811±10μs
                   complex       798±2μs
                  complex64      865±20μs
                  complex128     861±30μs
                datetime64[ns]   864±30μs
                    M8[ns]       869±40μs
               timedelta64[ns]   829±10μs
                    m8[ns]       820±6μs
                     bool        583±5μs
                     bool        592±8μs
              ================= ==========

[ 62.50%] ··· dtypes.SelectDtypes.time_select_dtype_bool_include                                                            ok
[ 62.50%] ··· ================= ===========
                    dtype
              ----------------- -----------
                    uint8         547±6μs
                    uint16        555±7μs
                    uint32        547±6μs
                    uint64        541±7μs
                     int          566±20μs
                     int8         560±20μs
                    int16         539±20μs
                    int32         579±40μs
                    int64         610±20μs
                    UInt8         603±30μs
                    UInt16        586±40μs
                    UInt32        570±30μs
                    UInt64        568±30μs
                     Int8         565±50μs
                    Int16         575±30μs
                    Int32         554±20μs
                    Int64        649±100μs
                    float         542±20μs
                   float32       619±100μs
                   float64        564±90μs
                   complex        531±30μs
                  complex64       557±20μs
                  complex128     658±200μs
                datetime64[ns]    570±30μs
                    M8[ns]        560±7μs
               timedelta64[ns]    545±6μs
                    m8[ns]        536±8μs
                     bool         744±10μs
                     bool         766±5μs
              ================= ===========

[ 68.75%] ··· dtypes.SelectDtypes.time_select_dtype_float_exclude                                                           ok
[ 68.75%] ··· ================= ===========
                    dtype
              ----------------- -----------
                    uint8         811±9μs
                    uint16        798±10μs
                    uint32        828±40μs
                    uint64        817±10μs
                     int          800±30μs
                     int8         817±30μs
                    int16        910±100μs
                    int32         819±20μs
                    int64         807±10μs
                    UInt8         802±10μs
                    UInt16        776±20μs
                    UInt32        795±10μs
                    UInt64        798±20μs
                     Int8         791±10μs
                    Int16         771±10μs
                    Int32         778±9μs
                    Int64         782±9μs
                    float         572±7μs
                   float32        809±10μs
                   float64        583±3μs
                   complex        777±8μs
                  complex64       789±20μs
                  complex128      829±30μs
                datetime64[ns]    803±20μs
                    M8[ns]        782±7μs
               timedelta64[ns]    792±9μs
                    m8[ns]        810±6μs
                     bool         891±90μs
                     bool         790±10μs
              ================= ===========

[ 75.00%] ··· dtypes.SelectDtypes.time_select_dtype_float_include                                                           ok
[ 75.00%] ··· ================= ===========
                    dtype
              ----------------- -----------
                    uint8         538±6μs
                    uint16        552±10μs
                    uint32        543±7μs
                    uint64        531±7μs
                     int          515±10μs
                     int8         541±5μs
                    int16         542±10μs
                    int32         543±8μs
                    int64         539±4μs
                    UInt8         530±8μs
                    UInt16        537±6μs
                    UInt32        531±4μs
                    UInt64        542±6μs
                     Int8         521±8μs
                    Int16         528±7μs
                    Int32         545±20μs
                    Int64         528±8μs
                    float         716±20μs
                   float32        549±4μs
                   float64        733±4μs
                   complex        519±10μs
                  complex64       559±30μs
                  complex128      583±30μs
                datetime64[ns]    561±30μs
                    M8[ns]        553±20μs
               timedelta64[ns]   642±100μs
                    m8[ns]        544±9μs
                     bool         525±3μs
                     bool         527±4μs
              ================= ===========

[ 81.25%] ··· dtypes.SelectDtypes.time_select_dtype_int_exclude                                                             ok
[ 81.25%] ··· ================= ===========
                    dtype
              ----------------- -----------
                    uint8         861±20μs
                    uint16        866±6μs
                    uint32       929±300μs
                    uint64        890±10μs
                     int          577±10μs
                     int8         861±6μs
                    int16         866±20μs
                    int32         889±20μs
                    int64         586±9μs
                    UInt8         842±5μs
                    UInt16        840±10μs
                    UInt32        845±10μs
                    UInt64        884±70μs
                     Int8        931±200μs
                    Int16         869±9μs
                    Int32         830±10μs
                    Int64         568±6μs
                    float         847±10μs
                   float32        878±20μs
                   float64        852±2μs
                   complex        838±8μs
                  complex64       850±10μs
                  complex128      863±10μs
                datetime64[ns]    866±10μs
                    M8[ns]        852±10μs
               timedelta64[ns]    842±10μs
                    m8[ns]        869±9μs
                     bool         832±10μs
                     bool         876±9μs
              ================= ===========

[ 87.50%] ··· dtypes.SelectDtypes.time_select_dtype_int_include                                                                                                                                                             ok
[ 87.50%] ··· ================= ===========
                    dtype
              ----------------- -----------
                    uint8         542±9μs
                    uint16        539±9μs
                    uint32        544±10μs
                    uint64        555±20μs
                     int          808±9μs
                     int8         558±20μs
                    int16        682±200μs
                    int32         546±10μs
                    int64         800±6μs
                    UInt8         536±6μs
                    UInt16        528±7μs
                    UInt32        531±6μs
                    UInt64        541±10μs
                     Int8         526±2μs
                    Int16         532±10μs
                    Int32         527±4μs
                    Int64         786±8μs
                    float         518±4μs
                   float32        545±10μs
                   float64        536±7μs
                   complex        522±6μs
                  complex64       551±10μs
                  complex128      542±7μs
                datetime64[ns]    540±10μs
                    M8[ns]        539±9μs
               timedelta64[ns]    553±10μs
                    m8[ns]        539±10μs
                     bool         532±4μs
                     bool         541±8μs
              ================= ===========

[ 93.75%] ··· dtypes.SelectDtypes.time_select_dtype_string_exclude                                                                                                                                                          ok
[ 93.75%] ··· ================= =============
                    dtype
              ----------------- -------------
                    uint8        1.67±0.05ms
                    uint16       1.70±0.03ms
                    uint32       1.70±0.02ms
                    uint64       1.67±0.03ms
                     int         1.69±0.04ms
                     int8        1.71±0.05ms
                    int16        1.74±0.05ms
                    int32        1.72±0.02ms
                    int64        1.73±0.02ms
                    UInt8        1.70±0.03ms
                    UInt16       1.70±0.02ms
                    UInt32       1.70±0.04ms
                    UInt64       1.68±0.02ms
                     Int8        1.66±0.02ms
                    Int16        1.68±0.01ms
                    Int32        1.68±0.01ms
                    Int64        1.72±0.02ms
                    float        1.70±0.03ms
                   float32       1.69±0.03ms
                   float64       1.65±0.01ms
                   complex       1.67±0.01ms
                  complex64      1.71±0.03ms
                  complex128     1.68±0.02ms
                datetime64[ns]   1.75±0.02ms
                    M8[ns]       1.72±0.03ms
               timedelta64[ns]   1.70±0.01ms
                    m8[ns]       1.69±0.02ms
                     bool        1.69±0.02ms
                     bool        1.69±0.01ms
              ================= =============

[100.00%] ··· dtypes.SelectDtypes.time_select_dtype_string_include                                                                                                                                                          ok
[100.00%] ··· ================= ==========
                    dtype
              ----------------- ----------
                    uint8        550±2μs
                    uint16       555±10μs
                    uint32       534±6μs
                    uint64       535±9μs
                     int         518±6μs
                     int8        549±10μs
                    int16        532±6μs
                    int32        527±10μs
                    int64        538±9μs
                    UInt8        534±10μs
                    UInt16       533±10μs
                    UInt32       545±10μs
                    UInt64       536±4μs
                     Int8        531±10μs
                    Int16        535±9μs
                    Int32        537±2μs
                    Int64        528±8μs
                    float        520±10μs
                   float32       600±80μs
                   float64       551±6μs
                   complex       515±6μs
                  complex64      560±10μs
                  complex128     554±7μs
                datetime64[ns]   545±8μs
                    M8[ns]       558±10μs
               timedelta64[ns]   543±10μs
                    m8[ns]       539±3μs
                     bool        533±5μs
                     bool        532±4μs
              ================= ==========
</details>
thanks @avinashpancham