Skip to content

Commit a87dfb5

Browse files
authored
Merge pull request #19322 from apple/revert-19097-fluctuation-of-the-pupil
Revert "[benchmark] Report Quantiles from Benchmark_O and a TON of Gardening"
2 parents 45d4227 + 423e145 commit a87dfb5

File tree

7 files changed

+206
-312
lines changed

7 files changed

+206
-312
lines changed

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ class BenchmarkDoctor(object):
434434
measurements = dict(
435435
[('{0} {1} i{2}{3}'.format(benchmark, o, i, suffix),
436436
self.driver.run(benchmark, num_samples=s, num_iters=i,
437-
verbose=True, measure_memory=True))
437+
verbose=True))
438438
for o in opts
439439
for s, i in run_args
440440
for suffix in list('abcde')

benchmark/scripts/compare_perf_tests.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ class `ReportFormatter` creates the test comparison report in specified format.
3434
import sys
3535
from bisect import bisect, bisect_left, bisect_right
3636
from collections import namedtuple
37-
from decimal import Decimal, ROUND_HALF_EVEN
3837
from math import sqrt
3938

4039

@@ -142,32 +141,20 @@ def max(self):
142141
"""Maximum sampled value."""
143142
return self.samples[-1].runtime
144143

145-
def quantile(self, q):
146-
"""Return runtime of a sample nearest to the quantile.
147-
148-
Explicitly uses round-half-to-even rounding algorithm to match the
149-
behavior of numpy's quantile(interpolation='nearest') and quantile
150-
estimate type R-3, SAS-2. See:
151-
https://en.wikipedia.org/wiki/Quantile#Estimating_quantiles_from_a_sample
152-
"""
153-
index = int(Decimal((self.count - 1) * Decimal(q))
154-
.quantize(0, ROUND_HALF_EVEN))
155-
return self.samples[index].runtime
156-
157144
@property
158145
def median(self):
159146
"""Median sampled value."""
160-
return self.quantile(0.5)
147+
return self.samples[self.count / 2].runtime
161148

162149
@property
163150
def q1(self):
164151
"""First Quartile (25th Percentile)."""
165-
return self.quantile(0.25)
152+
return self.samples[self.count / 4].runtime
166153

167154
@property
168155
def q3(self):
169156
"""Third Quartile (75th Percentile)."""
170-
return self.quantile(0.75)
157+
return self.samples[(self.count / 2) + (self.count / 4)].runtime
171158

172159
@property
173160
def iqr(self):

benchmark/scripts/test_Benchmark_Driver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,10 +476,10 @@ def test_measure_10_independent_1s_benchmark_series(self):
476476
# 5x i1 series, with 300 μs runtime its possible to take 4098
477477
# samples/s, but it should be capped at 2k
478478
([(_run('B1', num_samples=2048, num_iters=1,
479-
verbose=True, measure_memory=True), _PTR(min=300))] * 5) +
479+
verbose=True), _PTR(min=300))] * 5) +
480480
# 5x i2 series
481481
([(_run('B1', num_samples=2048, num_iters=2,
482-
verbose=True, measure_memory=True), _PTR(min=300))] * 5)
482+
verbose=True), _PTR(min=300))] * 5)
483483
))
484484
doctor = BenchmarkDoctor(self.args, driver)
485485
with captured_output() as (out, _):

benchmark/scripts/test_compare_perf_tests.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def test_computes_five_number_summary(self):
7575
self.samples, (1000, 1000, 1000, 1000, 1000))
7676
self.samples.add(Sample(2, 1, 1100))
7777
self.assertEqualFiveNumberSummary(
78-
self.samples, (1000, 1000, 1000, 1100, 1100))
78+
self.samples, (1000, 1000, 1100, 1100, 1100))
7979
self.samples.add(Sample(3, 1, 1050))
8080
self.assertEqualFiveNumberSummary(
81-
self.samples, (1000, 1000, 1050, 1100, 1100))
81+
self.samples, (1000, 1000, 1050, 1050, 1100))
8282
self.samples.add(Sample(4, 1, 1025))
8383
self.assertEqualFiveNumberSummary(
84-
self.samples, (1000, 1025, 1050, 1050, 1100))
84+
self.samples, (1000, 1025, 1050, 1100, 1100))
8585
self.samples.add(Sample(5, 1, 1075))
8686
self.assertEqualFiveNumberSummary(
8787
self.samples, (1000, 1025, 1050, 1075, 1100))
@@ -156,12 +156,11 @@ def test_excludes_outliers_zero_IQR(self):
156156
self.samples.add(Sample(0, 2, 23))
157157
self.samples.add(Sample(1, 2, 18))
158158
self.samples.add(Sample(2, 2, 18))
159-
self.samples.add(Sample(3, 2, 18))
160159
self.assertEquals(self.samples.iqr, 0)
161160

162161
self.samples.exclude_outliers()
163162

164-
self.assertEquals(self.samples.count, 3)
163+
self.assertEquals(self.samples.count, 2)
165164
self.assertEqualStats(
166165
(self.samples.min, self.samples.max), (18, 18))
167166

@@ -369,6 +368,7 @@ def test_parse_results_verbose(self):
369368
Sample 0,11812
370369
Measuring with scale 90.
371370
Sample 1,13898
371+
Measuring with scale 91.
372372
Sample 2,11467
373373
1,AngryPhonebook,3,11467,13898,12392,1315,11812
374374
Running Array2D for 3 samples.
@@ -388,7 +388,7 @@ def test_parse_results_verbose(self):
388388
)
389389
self.assertEquals(r.num_samples, r.samples.num_samples)
390390
self.assertEquals(results[0].samples.all_samples,
391-
[(0, 78, 11812), (1, 90, 13898), (2, 90, 11467)])
391+
[(0, 78, 11812), (1, 90, 13898), (2, 91, 11467)])
392392

393393
r = results[1]
394394
self.assertEquals(

0 commit comments

Comments
 (0)