We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0985990 commit b535c98Copy full SHA for b535c98
src/testing/benchmark.go
@@ -326,7 +326,13 @@ func (b *B) launch() {
326
// Run more iterations than we think we'll need (1.2x).
327
n += n / 5
328
// Don't grow too fast in case we had timing errors previously.
329
- n = min(n, 100*last)
+ 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
+ }
336
// Be sure to run at least one more than last time.
337
n = max(n, last+1)
338
// Don't run more than 1e9 times. (This also keeps n in int range on 32 bit platforms.)
0 commit comments