Skip to content

Commit b535c98

Browse files
committed
fix benchtime timeout
1 parent 0985990 commit b535c98

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/testing/benchmark.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,13 @@ func (b *B) launch() {
326326
// Run more iterations than we think we'll need (1.2x).
327327
n += n / 5
328328
// Don't grow too fast in case we had timing errors previously.
329-
n = min(n, 100*last)
329+
if n < 0 {
330+
// If n < 0 (overflow int64), means need to be executed many times,
331+
// Otherwise it is easy to time out.
332+
n = max(n, 100*last)
333+
} else {
334+
n = min(n, 100*last)
335+
}
330336
// Be sure to run at least one more than last time.
331337
n = max(n, last+1)
332338
// Don't run more than 1e9 times. (This also keeps n in int range on 32 bit platforms.)

0 commit comments

Comments
 (0)