Skip to content

Commit 4d2c56e

Browse files
committed
fix(lint): correct stale benchmark comment about the ColumnOfOffset fix
The comment described an earlier bytes.LastIndexByte approach that was abandoned (benchmarking showed no SIMD assembly backs LastIndexByte on any platform) in favor of the binary-search fix actually shipped. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCh2j2oeSw6UgNsmpjRonL
1 parent 306d458 commit 4d2c56e

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

internal/lint/column_bench_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import (
55
"testing"
66
)
77

8-
// BenchmarkColumnOfOffset_LongLine exercises the worst case for
9-
// ColumnOfOffset: an offset near the end of a very long line, forcing a
10-
// full backward scan to find the line start. Per
11-
// docs/development/high-performance-go.md, a hand-rolled byte-at-a-time
12-
// scan is not vectorized by the compiler; bytes.LastIndexByte is SIMD
13-
// assembly on amd64.
8+
// BenchmarkColumnOfOffset_LongLine exercises the former worst case for
9+
// ColumnOfOffset: an offset near the end of a very long line, which used
10+
// to force a full backward byte-at-a-time scan to find the line start.
11+
// ColumnOfOffset now reuses LineOfOffset's cached newline index via a
12+
// binary search instead (docs/development/high-performance-go.md).
1413
func BenchmarkColumnOfOffset_LongLine(b *testing.B) {
1514
line := bytes.Repeat([]byte("x"), 8192)
1615
src := append(append([]byte("prefix\n"), line...), '\n')

0 commit comments

Comments
 (0)