72
72
# "bench_ufunc",
73
73
]
74
74
75
+ SKIPPED_NUMPY_BENCHMARKS = [
76
+ "bench_core.CountNonzero.time_count_nonzero(3, 1000000, <class 'str'>)" , # Times out
77
+ "bench_core.CountNonzero.time_count_nonzero_axis(3, 1000000, <class 'str'>)" , # Times out
78
+ "bench_core.CountNonzero.time_count_nonzero_multi_axis(3, 1000000, <class 'str'>)" , # Times out
79
+ "bench_linalg.LinalgSmallArrays.time_det_small_array" , # TODO fails with numpy.linalg.LinAlgError
80
+ ]
81
+
75
82
DEFAULT_PANDAS_BENCHMARKS = [
76
83
"reshape" ,
77
84
"replace"
78
85
]
79
86
87
+ SKIPPED_PANDAS_BENCHMARKS = [
88
+ "replace.ReplaceDict.time_replace_series" , # Times out
89
+ "replace.ReplaceList.time_replace_list" , # OOM, WIP msimacek
90
+ "replace.ReplaceList.time_replace_list_one_match" , # OOM, WIP msimacek
91
+ "reshape.Crosstab.time_crosstab_normalize_margins" , # Times out
92
+ "reshape.Cut.peakmem_cut_interval" , # Times out
93
+ "reshape.Cut.time_cut_interval" , # Times out
94
+ "reshape.GetDummies.time_get_dummies_1d_sparse" , # Times out
95
+ "reshape.PivotTable.time_pivot_table_margins" , # Times out
96
+ "reshape.WideToLong.time_wide_to_long_big" , # Times out
97
+ ]
98
+
80
99
DEFAULT_PYPERFORMANCE_BENCHMARKS = [
81
100
# "2to3",
82
101
# "chameleon",
173
192
]
174
193
175
194
195
+ def create_asv_benchmark_selection (benchmarks , skipped = ()):
196
+ regex = '|' .join (benchmarks )
197
+ if not skipped :
198
+ return regex
199
+ negative_lookaheads = [re .escape (skip ) + (r'\b' if not skip .endswith (')' ) else '' ) for skip in skipped ]
200
+ return '^(?!' + '|' .join (negative_lookaheads ) + ')(' + regex + ')'
201
+
202
+
176
203
class PyPerfJsonRule (mx_benchmark .Rule ):
177
204
"""Parses a JSON file produced by PyPerf and creates a measurement result."""
178
205
@@ -656,22 +683,18 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
656
683
657
684
658
685
class NumPySuite (PySuite ):
659
- VERSION = "v1.23.5"
660
-
661
- PREREQUISITES = """
662
- setuptools==63.1.0
663
- wheel==0.37.1
664
- """
665
-
666
- BENCHMARK_REQ = f"""
667
- asv==0.5.1
668
- distlib==0.3.6
669
- filelock==3.8.0
670
- platformdirs==2.5.2
671
- six==1.16.0
672
- virtualenv==20.16.3
673
- numpy=={ VERSION }
674
- """
686
+ VERSION = "v1.26.4"
687
+
688
+ BENCHMARK_REQ = [
689
+ "asv==0.5.1" ,
690
+ "distlib==0.3.6" ,
691
+ "filelock==3.8.0" ,
692
+ "platformdirs==2.5.2" ,
693
+ "six==1.16.0" ,
694
+ "virtualenv==20.16.3" ,
695
+ "packaging==24.0" ,
696
+ f"numpy=={ VERSION } " ,
697
+ ]
675
698
676
699
def name (self ):
677
700
return "numpy-suite"
@@ -730,21 +753,13 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
730
753
731
754
vm .run (workdir , ["-m" , "venv" , join (workdir , vm_venv )])
732
755
pip = join (workdir , vm_venv , "bin" , "pip" )
733
- requirements_txt = join (workdir , "requirements.txt" )
734
- with open (requirements_txt , "w" ) as f :
735
- f .write (self .PREREQUISITES )
736
- mx .run ([pip , "install" , "-r" , requirements_txt ], cwd = workdir )
737
- with open (requirements_txt , "w" ) as f :
738
- f .write (self .BENCHMARK_REQ )
739
- mx .run ([pip , "install" , "-r" , requirements_txt ], cwd = workdir )
756
+ mx .run ([pip , "install" , * self .BENCHMARK_REQ ], cwd = workdir )
740
757
mx .run (
741
758
[join (workdir , vm_venv , "bin" , "asv" ), "machine" , "--yes" ], cwd = benchdir
742
759
)
743
760
744
- if benchmarks :
745
- bms = ["-b" , "|" .join (benchmarks )]
746
- else :
747
- bms = ["-b" , "|" .join (DEFAULT_NUMPY_BENCHMARKS )]
761
+ if not benchmarks :
762
+ benchmarks = DEFAULT_NUMPY_BENCHMARKS
748
763
retcode = mx .run (
749
764
[
750
765
join (workdir , vm_venv , "bin" , "asv" ),
@@ -755,7 +770,7 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
755
770
"--python=same" ,
756
771
"--set-commit-hash" ,
757
772
self .VERSION ,
758
- * bms ,
773
+ "-b" , create_asv_benchmark_selection ( benchmarks , skipped = SKIPPED_NUMPY_BENCHMARKS ) ,
759
774
],
760
775
cwd = benchdir ,
761
776
nonZeroIsFatal = False ,
@@ -775,22 +790,17 @@ class PandasSuite(PySuite):
775
790
VERSION = "1.5.2"
776
791
VERSION_TAG = "v" + VERSION
777
792
778
- PREREQUISITES = """
779
- setuptools==63.1.0
780
- wheel==0.37.1
781
- """
782
-
783
- BENCHMARK_REQ = f"""
784
- asv==0.5.1
785
- distlib==0.3.6
786
- filelock==3.8.0
787
- platformdirs==2.5.2
788
- six==1.16.0
789
- virtualenv==20.16.3
790
- jinja2
791
- numpy==1.23.5
792
- pandas=={ VERSION }
793
- """
793
+ BENCHMARK_REQ = [
794
+ "asv==0.5.1" ,
795
+ "distlib==0.3.6" ,
796
+ "filelock==3.8.0" ,
797
+ "platformdirs==2.5.2" ,
798
+ "six==1.16.0" ,
799
+ "virtualenv==20.16.3" ,
800
+ "jinja2" ,
801
+ f"numpy=={ NumPySuite .VERSION } " ,
802
+ f"pandas=={ VERSION } " ,
803
+ ]
794
804
795
805
def name (self ):
796
806
return "pandas-suite"
@@ -870,21 +880,13 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
870
880
871
881
vm .run (workdir , ["-m" , "venv" , join (workdir , vm_venv )])
872
882
pip = join (workdir , vm_venv , "bin" , "pip" )
873
- requirements_txt = join (workdir , "requirements.txt" )
874
- with open (requirements_txt , "w" ) as f :
875
- f .write (self .PREREQUISITES )
876
- mx .run ([pip , "install" , "-r" , requirements_txt ], cwd = workdir )
877
- with open (requirements_txt , "w" ) as f :
878
- f .write (self .BENCHMARK_REQ )
879
- mx .run ([pip , "install" , "-r" , requirements_txt ], cwd = workdir )
883
+ mx .run ([pip , "install" , * self .BENCHMARK_REQ ], cwd = workdir )
880
884
mx .run (
881
885
[join (workdir , vm_venv , "bin" , "asv" ), "machine" , "--yes" ], cwd = benchdir
882
886
)
883
887
884
- if benchmarks :
885
- bms = ["-b" , "|" .join (benchmarks )]
886
- else :
887
- bms = ["-b" , "|" .join (DEFAULT_PANDAS_BENCHMARKS )]
888
+ if not benchmarks :
889
+ benchmarks = DEFAULT_PANDAS_BENCHMARKS
888
890
retcode = mx .run (
889
891
[
890
892
join (workdir , vm_venv , "bin" , "asv" ),
@@ -895,7 +897,7 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
895
897
"--python=same" ,
896
898
"--set-commit-hash" ,
897
899
self .VERSION_TAG ,
898
- * bms ,
900
+ "-b" , create_asv_benchmark_selection ( benchmarks , skipped = SKIPPED_PANDAS_BENCHMARKS ) ,
899
901
],
900
902
cwd = benchdir ,
901
903
nonZeroIsFatal = False ,
0 commit comments