---
title: "benchmark-iteration-mutation"
description: "Detect assignments to testing.B.N."
image: "https://strider.gempir.com/og.png"
---

> Documentation Index
> Fetch the complete documentation index at: https://strider.gempir.com/llms.txt
> Use this file to discover all available pages before exploring further.

# benchmark-iteration-mutation

**Default severity:** `error`

The testing package dynamically controls `B.N` to calibrate benchmark
duration and calculate per-operation time. Benchmark code that changes `N`
invalidates those measurements.

## Bad

```go
b.N = 1000
```

## Good

```go
for range b.N { operation() }
```

Source: https://strider.gempir.com/analyzers/benchmark-iteration-mutation/index.mdx
