Skip to content

Commit 67db9e1

Browse files
committed
---
yaml --- r: 142924 b: refs/heads/try2 c: 6d78a36 h: refs/heads/master v: v3
1 parent d91dc28 commit 67db9e1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 4bf6b84a4d23606394fb7176b4f2f216dff06e5b
8+
refs/heads/try2: 6d78a367b1f5721624c7f8b66b1796303f0b6f45
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/test.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ impl MetricMap {
845845
if delta.abs() <= noise {
846846
LikelyNoise
847847
} else {
848-
let pct = delta.abs() / vold.value * 100.0;
848+
let pct = delta.abs() / (vold.value).max(&f64::epsilon) * 100.0;
849849
if vold.noise < 0.0 {
850850
// When 'noise' is negative, it means we want
851851
// to see deltas that go up over time, and can
@@ -954,7 +954,7 @@ impl BenchHarness {
954954
if self.iterations == 0 {
955955
0
956956
} else {
957-
self.ns_elapsed() / self.iterations
957+
self.ns_elapsed() / self.iterations.max(&1)
958958
}
959959
}
960960

@@ -977,7 +977,7 @@ impl BenchHarness {
977977
if self.ns_per_iter() == 0 {
978978
n = 1_000_000;
979979
} else {
980-
n = 1_000_000 / self.ns_per_iter();
980+
n = 1_000_000 / self.ns_per_iter().max(&1);
981981
}
982982

983983
let mut total_run = 0;
@@ -1047,7 +1047,8 @@ pub mod bench {
10471047

10481048
let ns_iter_summ = bs.auto_bench(f);
10491049

1050-
let iter_s = 1_000_000_000 / (ns_iter_summ.median as u64);
1050+
let ns_iter = (ns_iter_summ.median as u64).max(&1);
1051+
let iter_s = 1_000_000_000 / ns_iter;
10511052
let mb_s = (bs.bytes * iter_s) / 1_000_000;
10521053

10531054
BenchSamples {

0 commit comments

Comments
 (0)