1
- From 11634e6f497f7fb9a3509c549832f94b5cb86865 Mon Sep 17 00:00:00 2001
1
+ From 9edd0115fec81c1add7e1301eaccb0a3eef49d2e Mon Sep 17 00:00:00 2001
2
2
From: Mohaned Qunaibit <
[email protected] >
3
- Date: Fri, 1 Dec 2023 05:32:57 +0300
4
- Subject: [PATCH] Add asv features
3
+ Date: Tue, 5 Dec 2023 14:47:39 +0300
4
+ Subject: [PATCH] patch 0.5.1
5
5
6
6
---
7
7
LICENSE.rst | 1 +
8
8
README.rst | 51 +++++
9
- asv/benchmark.py | 40 +++-
9
+ asv/benchmark.py | 38 +++-
10
10
asv/commands/common_args.py | 19 ++
11
11
asv/commands/publish.py | 11 ++
12
12
asv/commands/run.py | 2 +-
@@ -19,7 +19,7 @@ Subject: [PATCH] Add asv features
19
19
asv/www/comparisonlist.js | 362 ++++++++++++++++++++++++++++++++++
20
20
asv/www/index.html | 9 +
21
21
docs/source/benchmarks.rst | 3 +
22
- 15 files changed, 899 insertions(+), 27 deletions(-)
22
+ 15 files changed, 898 insertions(+), 26 deletions(-)
23
23
create mode 100644 asv/plugins/comparisonlist.py
24
24
create mode 100644 asv/www/comparisonlist.css
25
25
create mode 100644 asv/www/comparisonlist.js
@@ -97,10 +97,10 @@ index e916d68..62fca24 100644
97
97
<http://opensource.org/licenses/BSD-3-Clause>`__.
98
98
99
99
diff --git a/asv/benchmark.py b/asv/benchmark.py
100
- index d92b4a7..721d272 100644
100
+ index 3f5a9e7..55c93ff 100644
101
101
--- a/asv/benchmark.py
102
102
+++ b/asv/benchmark.py
103
- @@ -359 ,6 +359 ,8 @@ class Benchmark:
103
+ @@ -462 ,6 +462 ,8 @@ class Benchmark(object) :
104
104
self._params = _get_first_attr(attr_sources, "params", [])
105
105
self.param_names = _get_first_attr(attr_sources, "param_names", [])
106
106
self._current_params = ()
@@ -109,14 +109,14 @@ index d92b4a7..721d272 100644
109
109
110
110
# Enforce params format
111
111
try:
112
- @@ -445 ,12 +447,23 @@ class Benchmark:
112
+ @@ -548 ,12 +550,22 @@ class Benchmark(object) :
113
113
try:
114
114
for setup in self._setups:
115
115
setup(*self._current_params)
116
116
+ self.warmup_process()
117
117
except NotImplementedError as e:
118
118
# allow skipping test
119
- print(f "asv: skipped: {e !r} ")
119
+ print("asv: skipped: {!r} ".format(e) )
120
120
return True
121
121
return False
122
122
@@ -128,12 +128,11 @@ index d92b4a7..721d272 100644
128
128
+ self.warmup_func()
129
129
+ warmup_count -= 1
130
130
+ self.warmup_func = None
131
- +
132
131
+
133
132
def redo_setup(self):
134
133
if not self._redo_setup_next:
135
134
self._redo_setup_next = True
136
- @@ -512 ,6 +525 ,8 @@ class TimeBenchmark(Benchmark):
135
+ @@ -615 ,6 +627 ,8 @@ class TimeBenchmark(Benchmark):
137
136
self.sample_time = _get_first_attr(self._attr_sources, 'sample_time', 0.01)
138
137
self.warmup_time = _get_first_attr(self._attr_sources, 'warmup_time', -1)
139
138
self.timer = _get_first_attr(self._attr_sources, 'timer', wall_timer)
@@ -142,7 +141,7 @@ index d92b4a7..721d272 100644
142
141
143
142
def do_setup(self):
144
143
result = Benchmark.do_setup(self)
145
- @@ -526 ,6 +541 ,8 @@ class TimeBenchmark(Benchmark):
144
+ @@ -628 ,6 +642 ,8 @@ class TimeBenchmark(Benchmark):
146
145
else:
147
146
func = self.func
148
147
@@ -151,7 +150,7 @@ index d92b4a7..721d272 100644
151
150
timer = timeit.Timer(
152
151
stmt=func,
153
152
setup=self.redo_setup,
154
- @@ -534 ,10 +551 ,19 @@ class TimeBenchmark(Benchmark):
153
+ @@ -636 ,10 +652 ,19 @@ class TimeBenchmark(Benchmark):
155
154
return timer
156
155
157
156
def run(self, *param):
@@ -171,16 +170,15 @@ index d92b4a7..721d272 100644
171
170
else:
172
171
# Transient effects exist also on CPython, e.g. from
173
172
# OS scheduling
174
- @@ -569,14 +595,24 @@ class TimeBenchmark(Benchmark):
175
- warmup_time=warmup_time,
173
+ @@ -672,13 +697,24 @@ class TimeBenchmark(Benchmark):
176
174
number=self.number,
177
175
min_run_count=self.min_run_count)
176
+
178
177
+ if self.do_maxrss == 2:
179
178
+ maxrss = get_maxrss()
180
-
181
- - samples = [s / number for s in samples]
179
+ +
180
+ samples = [s/ number for s in samples]
182
181
- return {'samples': samples, 'number': number}
183
- + samples = [s/number for s in samples]
184
182
+ return {'samples': samples, 'number': number, 'maxrss' : maxrss}
185
183
186
184
def benchmark_timing(self, timer, min_repeat, max_repeat, max_time, warmup_time,
@@ -199,10 +197,10 @@ index d92b4a7..721d272 100644
199
197
run_count = 0
200
198
201
199
diff --git a/asv/commands/common_args.py b/asv/commands/common_args.py
202
- index 05fcf15..749a40e 100644
200
+ index 76cc729..9625a85 100644
203
201
--- a/asv/commands/common_args.py
204
202
+++ b/asv/commands/common_args.py
205
- @@ -157 ,10 +157 ,19 @@ def add_bench(parser):
203
+ @@ -159 ,10 +159 ,19 @@ def add_bench(parser):
206
204
207
205
return affinity_list
208
206
@@ -222,7 +220,7 @@ index 05fcf15..749a40e 100644
222
220
'repeat': parse_repeat,
223
221
'number': int,
224
222
'rounds': int,
225
- @@ -181 ,6 +190 ,16 @@ def add_bench(parser):
223
+ @@ -183 ,6 +192 ,16 @@ def add_bench(parser):
226
224
help=("Set CPU affinity for running the benchmark, in format: "
227
225
"0 or 0,1,2 or 0-3. Default: not set"))
228
226
@@ -240,10 +238,10 @@ index 05fcf15..749a40e 100644
240
238
def add_machine(parser):
241
239
parser.add_argument(
242
240
diff --git a/asv/commands/publish.py b/asv/commands/publish.py
243
- index 9e84b0c..a16d20f 100644
241
+ index 43204e9..176e558 100644
244
242
--- a/asv/commands/publish.py
245
243
+++ b/asv/commands/publish.py
246
- @@ -58 ,6 +58 ,14 @@ class Publish(Command):
244
+ @@ -68 ,6 +68 ,14 @@ class Publish(Command):
247
245
'--html-dir', '-o', default=None, help=(
248
246
"Optional output directory. Default is 'html_dir' "
249
247
"from asv config"))
@@ -258,7 +256,7 @@ index 9e84b0c..a16d20f 100644
258
256
259
257
parser.set_defaults(func=cls.run_from_args)
260
258
261
- @@ -67 ,6 +75 ,9 @@ class Publish(Command):
259
+ @@ -77 ,6 +85 ,9 @@ class Publish(Command):
262
260
def run_from_conf_args(cls, conf, args):
263
261
if args.html_dir is not None:
264
262
conf.html_dir = args.html_dir
@@ -269,10 +267,10 @@ index 9e84b0c..a16d20f 100644
269
267
270
268
@staticmethod
271
269
diff --git a/asv/commands/run.py b/asv/commands/run.py
272
- index 457c127..b88028d 100644
270
+ index 9e19b6c..ed38412 100644
273
271
--- a/asv/commands/run.py
274
272
+++ b/asv/commands/run.py
275
- @@ -495 ,7 +495 ,7 @@ class Run(Command):
273
+ @@ -514 ,7 +514 ,7 @@ class Run(Command):
276
274
record_samples=(record_samples or force_record_samples),
277
275
append_samples=(append_samples or force_append_samples),
278
276
run_rounds=run_rounds,
@@ -282,10 +280,10 @@ index 457c127..b88028d 100644
282
280
skip_benchmarks(benchmark_set, env, results=result)
283
281
284
282
diff --git a/asv/config.py b/asv/config.py
285
- index 473007c..5137b55 100644
283
+ index c6d15d7..b52c846 100644
286
284
--- a/asv/config.py
287
285
+++ b/asv/config.py
288
- @@ -42 ,6 +42 ,8 @@ class Config:
286
+ @@ -46 ,6 +46 ,8 @@ class Config(object) :
289
287
self.build_command = None
290
288
self.install_command = None
291
289
self.uninstall_command = None
@@ -537,10 +535,10 @@ index 0000000..dfe078f
537
535
+ fp.write(row)
538
536
+ fp.write('\n\n\n')
539
537
diff --git a/asv/runner.py b/asv/runner.py
540
- index b5c6a7b..364ee95 100644
538
+ index 2c19e15..9321f33 100644
541
539
--- a/asv/runner.py
542
540
+++ b/asv/runner.py
543
- @@ -103 ,7 +103 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
541
+ @@ -111 ,7 +111 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
544
542
extra_params=None,
545
543
record_samples=False, append_samples=False,
546
544
run_rounds=None,
@@ -550,7 +548,7 @@ index b5c6a7b..364ee95 100644
550
548
"""
551
549
Run all of the benchmarks in the given `Environment`.
552
550
553
- @@ -156 ,6 +157 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
551
+ @@ -164 ,6 +165 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
554
552
extra_params['repeat'] = 1
555
553
extra_params['warmup_time'] = 0
556
554
extra_params['rounds'] = 1
@@ -559,7 +557,7 @@ index b5c6a7b..364ee95 100644
559
557
560
558
if results is None:
561
559
results = Results.unnamed()
562
- @@ -351 ,16 +354 ,29 @@ def run_benchmarks(benchmarks, env, results=None,
560
+ @@ -359 ,16 +362 ,29 @@ def run_benchmarks(benchmarks, env, results=None,
563
561
benchmark_durations[name] = (ended_at - started_at).total_seconds()
564
562
565
563
# Save result
@@ -591,7 +589,7 @@ index b5c6a7b..364ee95 100644
591
589
failed_benchmarks.add(name)
592
590
593
591
# Log result
594
- @@ -500 ,8 +516 ,11 @@ def run_benchmark(benchmark, spawner, profile,
592
+ @@ -508 ,8 +524 ,11 @@ def run_benchmark(benchmark, spawner, profile,
595
593
samples = []
596
594
number = []
597
595
profiles = []
@@ -603,16 +601,16 @@ index b5c6a7b..364ee95 100644
603
601
604
602
if benchmark['params']:
605
603
param_iter = enumerate(itertools.product(*benchmark['params']))
606
- @@ -514 ,6 +533 ,8 @@ def run_benchmark(benchmark, spawner, profile,
604
+ @@ -522 ,6 +541 ,8 @@ def run_benchmark(benchmark, spawner, profile,
607
605
samples.append(None)
608
606
number.append(None)
609
607
profiles.append(None)
610
- + result_maxrss.append(math .nan)
608
+ + result_maxrss.append(util .nan)
611
609
+ ignored_maxrss.append(None)
612
610
continue
613
611
614
612
if isinstance(extra_params, list):
615
- @@ -525 ,28 +546 ,44 @@ def run_benchmark(benchmark, spawner, profile,
613
+ @@ -533 ,28 +554 ,44 @@ def run_benchmark(benchmark, spawner, profile,
616
614
benchmark, spawner, param_idx,
617
615
extra_params=cur_extra_params, profile=profile,
618
616
cwd=cwd)
@@ -668,16 +666,16 @@ index b5c6a7b..364ee95 100644
668
666
669
667
670
668
def _run_benchmark_single_param(benchmark, spawner, param_idx,
671
- @@ -611 ,6 +648 ,7 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
669
+ @@ -619 ,6 +656 ,7 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
672
670
result = None
673
671
samples = None
674
672
number = None
675
673
+ maxrss = None
676
674
else:
677
675
with open(result_file.name, 'r') as stream:
678
676
data = stream.read()
679
- @@ -623 ,14 +661 ,16 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
680
- out += f "\n\nasv: failed to parse benchmark result: {exc }\n"
677
+ @@ -631 ,14 +669 ,16 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
678
+ out += "\n\nasv: failed to parse benchmark result: {0 }\n".format(exc)
681
679
682
680
# Special parsing for timing benchmark results
683
681
- if isinstance(data, dict) and 'samples' in data and 'number' in data:
@@ -694,7 +692,7 @@ index b5c6a7b..364ee95 100644
694
692
695
693
if benchmark['params'] and out:
696
694
params, = itertools.islice(itertools.product(*benchmark['params']),
697
- @@ -644 ,14 +684 ,22 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
695
+ @@ -652 ,14 +692 ,22 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
698
696
else:
699
697
profile_data = None
700
698
@@ -726,10 +724,10 @@ index b5c6a7b..364ee95 100644
726
724
spawner.interrupt()
727
725
raise util.UserError("Interrupted.")
728
726
diff --git a/asv/util.py b/asv/util.py
729
- index efed60d..0675bc1 100644
727
+ index 52eb96e..1165020 100644
730
728
--- a/asv/util.py
731
729
+++ b/asv/util.py
732
- @@ -523 ,7 +523 ,7 @@ def check_output(args, valid_return_codes=(0,), timeout=600, dots=True,
730
+ @@ -543 ,7 +543 ,7 @@ def check_output(args, valid_return_codes=(0,), timeout=600, dots=True,
733
731
kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
734
732
else:
735
733
kwargs['close_fds'] = True
@@ -1226,10 +1224,10 @@ index 0000000..3064adc
1226
1224
+ });
1227
1225
+ });
1228
1226
diff --git a/asv/www/index.html b/asv/www/index.html
1229
- index 5e2f651..8703284 100644
1227
+ index d1651ba..c69a6f1 100644
1230
1228
--- a/asv/www/index.html
1231
1229
+++ b/asv/www/index.html
1232
- @@ -33 ,6 +33 ,9 @@
1230
+ @@ -59 ,6 +59 ,9 @@
1233
1231
<script language="javascript" type="text/javascript"
1234
1232
src="summarylist.js">
1235
1233
</script>
@@ -1239,23 +1237,23 @@ index 5e2f651..8703284 100644
1239
1237
<script language="javascript" type="text/javascript"
1240
1238
src="graphdisplay.js">
1241
1239
</script>
1242
- @@ -42 ,6 +45 ,7 @@
1240
+ @@ -68 ,6 +71 ,7 @@
1243
1241
<link href="asv.css" rel="stylesheet" type="text/css"/>
1244
1242
<link href="regressions.css" rel="stylesheet" type="text/css"/>
1245
1243
<link href="summarylist.css" rel="stylesheet" type="text/css"/>
1246
1244
+ <link href="comparisonlist.css" rel="stylesheet" type="text/css"/>
1247
1245
<link rel="shortcut icon" href="swallow.ico"/>
1248
1246
<link rel="alternate" type="application/atom+xml" title="Regressions" href="regressions.xml"/>
1249
1247
</head>
1250
- @@ -57 ,6 +61 ,7 @@
1248
+ @@ -83 ,6 +87 ,7 @@
1251
1249
</li>
1252
1250
<li id="nav-li-" class="active"><a href="#/">Benchmark grid</a></li>
1253
1251
<li id="nav-li-summarylist"><a href="#/summarylist">Benchmark list</a></li>
1254
1252
+ <li id="nav-li-comparisonlist"><a href="#/comparisonlist">Comparison list</a></li>
1255
1253
<li id="nav-li-regressions"><a href="#/regressions">Regressions</a></li>
1256
1254
<li id="nav-li-graphdisplay">
1257
1255
<span class="navbar-brand" id="title">
1258
- @@ -73 ,6 +78 ,10 @@
1256
+ @@ -99 ,6 +104 ,10 @@
1259
1257
<div id="summarylist-body" style="position: absolute; left: 200px; top: 55px; bottom: 0px; right: 0px; overflow-y: scroll;">
1260
1258
</div>
1261
1259
</div>
@@ -1267,7 +1265,7 @@ index 5e2f651..8703284 100644
1267
1265
<div id="graphdisplay-navigation" class="asv-navigation" style="position: absolute; left: 0; top: 55px; bottom: 0; width: 200px; overflow-y: scroll">
1268
1266
<div class="panel panel-default">
1269
1267
diff --git a/docs/source/benchmarks.rst b/docs/source/benchmarks.rst
1270
- index 16ac796..a13a6b8 100644
1268
+ index 7a1e3a4..c8bf6eb 100644
1271
1269
--- a/docs/source/benchmarks.rst
1272
1270
+++ b/docs/source/benchmarks.rst
1273
1271
@@ -114,6 +114,9 @@ Timing benchmarks
0 commit comments