Grouped timings for parametrized tests

Sometimes it is convenient to group parametrized tests by function name, to look at the total time taken by the group of parametrized tests, rather than individual parametrized tests. When trying multiple combinations of parameters, it is easy to generate a big number of parametrized tests without realizing the total test time.

cc @jeremiedbb, something like this could be added CI if we think this is worth it. Right now we are only showing the 20 slowest individual tests we could add the 20 slowests tests with grouped parametrized tests.

To write the tests timings info to a file, add this to sklearn/conftests.py:
```py
def pytest_terminal_summary(terminalreporter, exitstatus, config):
    # use @ as CSV delimiter , ; and | are arising in test names so can not be used ...
    lines = ['name@duration\n']
    for reps in terminalreporter.stats.values():
        for rep in reps:
            if getattr(rep, 'when', None) == "call":
                line = f"{rep.nodeid}@{rep.duration}\n"
                lines.append(line)

    with open('/tmp/test_timings.csv', 'w') as test_timings_file:
        test_timings_file.writelines(lines)
```

To analyse the CSV:
```py
import pandas as pd

pd.options.display.max_colwidth = None
df = pd.read_csv('/tmp/test_timings.csv', delimiter='@')
df['function_name'] = df['name'].str.extract(r'(.+?)\[.+\]')
df['function_name'] = df['function_name'].where(df['function_name'].notna(), df['name'], axis=0)
print(df.groupby('function_name')['duration'].aggregate(['sum', 'size']).sort_values(by='sum', ascending=False).iloc[:50])
```

On my machine:
```                                                                                                                   
                                                                                                                 sum        size
function_name                                                                                                                   
sklearn/tests/test_common.py::test_estimators                                                                    90.395519  7291
sklearn/cluster/tests/test_k_means.py::test_k_means_fit_predict                                                  25.514541    32
sklearn/tests/test_kernel_approximation.py::test_polynomial_count_sketch                                         23.514811   108
sklearn/tests/test_common.py::test_search_cv                                                                     11.408637   640
sklearn/tree/tests/test_tree.py::test_prune_tree_regression_are_subtrees                                         10.413731    88
sklearn/inspection/_plot/tests/test_plot_partial_dependence.py::test_plot_partial_dependence_kind                 9.233481    24
sklearn/inspection/_plot/tests/test_plot_partial_dependence.py::test_partial_dependence_plot_limits_one_way       7.611308    12
sklearn/inspection/tests/test_partial_dependence.py::test_output_shape                                            7.524255   144
sklearn/tests/test_common.py::test_pandas_column_name_consistency                                                 7.299764   229
sklearn/decomposition/tests/test_dict_learning.py::test_minibatch_dictionary_learning_positivity                  6.513909    12
sklearn/linear_model/tests/test_quantile.py::test_quantile_estimates_calibration                                  6.451284     3
sklearn/model_selection/tests/test_split.py::test_stratified_kfold_ratios                                         6.122864    28
sklearn/tests/test_docstrings.py::test_docstring                                                                  6.090240  1803
sklearn/inspection/_plot/tests/test_plot_partial_dependence.py::test_plot_partial_dependence_lines_kw             5.780402    12
sklearn/tree/tests/test_tree.py::test_prune_tree_classifier_are_subtrees                                          5.337500    36
sklearn/decomposition/_dict_learning.py::sklearn.decomposition._dict_learning.DictionaryLearning                  5.231721     1
sklearn/utils/tests/test_estimator_checks.py::test_check_estimator_clones                                         4.757799     1
sklearn/tests/test_common.py::test_check_n_features_in_after_fitting                                              4.365753   195
sklearn/tests/test_calibration.py::test_calibration_multiclass                                                    4.298814     8
sklearn/ensemble/tests/test_forest.py::test_memory_layout                                                         4.225799     8
sklearn/_loss/tests/test_loss.py::test_loss_dtype                                                                 3.981264  1024
sklearn/neighbors/tests/test_neighbors.py::test_knn_forcing_backend                                               3.858353    20
sklearn/inspection/_plot/tests/test_plot_partial_dependence.py::test_partial_dependence_overwrite_labels          3.802329    12
sklearn/cluster/tests/test_k_means.py::test_predict                                                               3.793582    24
sklearn/tests/test_docstring_parameters.py::test_fit_docstring_attributes                                         3.763307   203
sklearn/inspection/tests/test_partial_dependence.py::test_partial_dependence_dataframe                            3.611114    12
sklearn/linear_model/tests/test_quantile.py::test_sparse_input                                                    3.534900    18
sklearn/mixture/tests/test_gaussian_mixture.py::test_init                                                         3.497789     1
sklearn/inspection/_plot/tests/test_plot_partial_dependence.py::test_plot_partial_dependence_passing_numpy_axes   3.449946     6
sklearn/ensemble/tests/test_forest.py::test_sparse_input                                                          3.325918    15
sklearn/linear_model/tests/test_sgd.py::test_SGDClassifier_fit_for_all_backends                                   3.193899     3
sklearn/metrics/tests/test_pairwise_distances_reduction.py::test_strategies_consistency                           3.174157    56
sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py::test_sample_weight_effect               3.005303     6
sklearn/ensemble/tests/test_forest.py::test_importances                                                           2.923119    20
sklearn/linear_model/tests/test_ridge.py::test_ridge_gcv_vs_ridge_loo_cv                                          2.905850    48
sklearn/cluster/tests/test_optics.py::test_dbscan_optics_parity                                                   2.799847     9
sklearn/inspection/_plot/tests/test_plot_partial_dependence.py::test_plot_partial_dependence_str_features         2.790852    26
sklearn/manifold/tests/test_spectral_embedding.py::test_spectral_embedding_precomputed_affinity                   2.748455     8
sklearn/model_selection/tests/test_successive_halving.py::test_aggressive_elimination                             2.747456     8
sklearn/neural_network/tests/test_mlp.py::test_n_iter_no_change_inf                                               2.743698     1
sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py::test_missing_values_resilience          2.473407     6
sklearn/impute/tests/test_impute.py::test_iterative_imputer_no_missing                                            2.403574     1
sklearn/ensemble/tests/test_weight_boosting.py::test_adaboost_consistent_predict                                  2.401502     2
sklearn/linear_model/tests/test_ridge.py::test_ridge_gcv_sample_weights                                           2.219063    32
sklearn/decomposition/tests/test_dict_learning.py::test_warning_default_transform_alpha                           2.208973     2
sklearn/linear_model/tests/test_quantile.py::test_equivariance                                                    2.128632     3
sklearn/neighbors/tests/test_neighbors.py::test_neigh_predictions_algorithm_agnosticity                           1.918901   168
sklearn/linear_model/tests/test_quantile.py::test_quantile_sample_weight                                          1.890437     1
sklearn/metrics/tests/test_pairwise_distances_reduction.py::test_pairwise_distances_radius_neighbors              1.859356    56
sklearn/experimental/tests/test_enable_iterative_imputer.py::test_imports_strategies                              1.771305     1
```

COMMENT:
The test suite duration has started to go wild again. Here's an updated timing result. Note that it's not the same machine so timings are hardly comparable but it gives an overview on the current dominant tests:
```
function_name                                                                                                                               
sklearn/tests/test_common.py::test_estimators                                                                               180.717243  7607
sklearn/tests/test_common.py::test_search_cv                                                                                 33.820111   664
sklearn/cluster/tests/test_optics.py::test_dbscan_optics_parity                                                              25.139903    27
sklearn/tests/test_common.py::test_pandas_column_name_consistency                                                            22.143263   232
sklearn/tests/test_common.py::test_check_n_features_in_after_fitting                                                         19.654588   198
sklearn/metrics/tests/test_pairwise_distances_reduction.py::test_pairwise_distances_argkmin                                  19.338943   112
sklearn/inspection/tests/test_partial_dependence.py::test_output_shape                                                       16.295373   144
sklearn/model_selection/tests/test_split.py::test_stratified_kfold_ratios                                                    11.344759    28
sklearn/tests/test_common.py::test_set_output_transform_pandas                                                               11.100834    85
sklearn/tests/test_common.py::test_global_output_transform_pandas                                                            10.580412    85
sklearn/_loss/tests/test_loss.py::test_loss_dtype                                                                             9.196461  1024
sklearn/utils/tests/test_estimator_checks.py::test_check_estimator_clones                                                     8.275155     1
sklearn/tree/tests/test_tree.py::test_prune_tree_regression_are_subtrees                                                      8.019008    88
sklearn/ensemble/tests/test_gradient_boosting.py::test_classification_synthetic                                               7.683116     2
sklearn/metrics/tests/test_pairwise_distances_reduction.py::test_pairwise_distances_radius_neighbors                          6.974885   112
sklearn/tests/test_calibration.py::test_calibration_multiclass                                                                6.808152     8
sklearn/ensemble/tests/test_forest.py::test_memory_layout                                                                     6.734647     8
sklearn/decomposition/_dict_learning.py::sklearn.decomposition._dict_learning.DictionaryLearning                              6.733604     1
sklearn/decomposition/tests/test_sparse_pca.py::test_sparse_pca_dtype_match                                                   6.552290    16
sklearn/ensemble/tests/test_stacking.py::test_stacking_classifier_multilabel_auto_predict                                     6.245717     4
sklearn/neighbors/tests/test_neighbors.py::test_knn_forcing_backend                                                           5.789497    20
sklearn/ensemble/tests/test_forest.py::test_forest_classifier_oob                                                             5.619970    48
sklearn/inspection/tests/test_partial_dependence.py::test_partial_dependence_dataframe                                        5.360347    12
sklearn/ensemble/tests/test_forest.py::test_sparse_input                                                                      5.128965    15
sklearn/ensemble/_hist_gradient_boosting/tests/test_gradient_boosting.py::test_sample_weight_effect                           5.073499     6
sklearn/linear_model/tests/test_ridge.py::test_ridge_gcv_vs_ridge_loo_cv                                                      4.887581    48
sklearn/ensemble/tests/test_forest.py::test_importances                                                                       4.781864    20
sklearn/model_selection/tests/test_successive_halving.py::test_aggressive_elimination                                         4.766265     8
sklearn/neural_network/tests/test_mlp.py::test_n_iter_no_change_inf                                                           4.418368     1
sklearn/tree/tests/test_tree.py::test_min_impurity_decrease                                                                   4.384769     1
sklearn/ensemble/tests/test_forest.py::test_forest_regressor_oob                                                              4.253921    24
sklearn/metrics/tests/test_pairwise_distances_reduction.py::test_strategies_consistency                                       4.058079    72
sklearn/linear_model/tests/test_sgd.py::test_SGDClassifier_fit_for_all_backends                                               4.032109     3
sklearn/linear_model/tests/test_ridge.py::test_ridge_gcv_sample_weights                                                       3.825349    32
sklearn/decomposition/tests/test_dict_learning.py::test_cd_work_on_joblib_memmapped_data                                      3.740673     1
sklearn/impute/tests/test_impute.py::test_iterative_imputer_no_missing                                                        3.684212     1
sklearn/neighbors/tests/test_neighbors.py::test_neigh_predictions_algorithm_agnosticity                                       3.657585   168
sklearn/tests/test_common.py::test_set_output_transform                                                                       3.453722    85
sklearn/metrics/tests/test_common.py::test_multilabel_sample_weight_invariance                                                3.289186    54
sklearn/utils/tests/test_extmath.py::test_randomized_svd_lapack_driver                                                        3.096808   135
sklearn/preprocessing/tests/test_target_encoder.py::test_fit_transform_not_associated_with_y_if_ordinal_categorical_is_not    3.093803     1
sklearn/decomposition/tests/test_sparse_pca.py::test_sparse_pca_numerical_consistency                                         2.911850     4
sklearn/decomposition/tests/test_sparse_pca.py::test_mini_batch_correct_shapes                                                2.910159     1
sklearn/ensemble/tests/test_stacking.py::test_stacking_regressor_diabetes                                                     2.872881    12
sklearn/model_selection/tests/test_split.py::test_stratified_kfold_label_invariance                                           2.839758    12
sklearn/tests/test_config.py::test_config_threadsafe_joblib                                                                   2.810967     3
sklearn/manifold/tests/test_spectral_embedding.py::test_spectral_embedding_precomputed_affinity                               2.682052     8
sklearn/tests/test_common.py::test_transformers_get_feature_names_out                                                         2.638481    82
sklearn/decomposition/tests/test_sparse_pca.py::test_transform_inverse_transform_round_trip                                   2.593636     2
sklearn/experimental/tests/test_enable_iterative_imputer.py::test_imports_strategies                                          2.559054     1
```

Labels: Build / CI