diff options
| author | apocelipes <seve3r@outlook.com> | 2026-03-09 17:32:42 +0000 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-10 20:07:05 -0700 |
| commit | 935ba2e486d035c60104217eec8f2a223cdb3bef (patch) | |
| tree | 798d8bd012c863d53c3bc96c79f0d3eb31d78f19 /src/bytes/bytes_test.go | |
| parent | e22dc6c86685aef76a9bb22ff186d4cd5a822027 (diff) | |
| download | go-935ba2e486d035c60104217eec8f2a223cdb3bef.tar.xz | |
bytes: remove unused indexBytePortable
The function "indexBytePortable" is no longer in use, and we have an
identical one in "internal/bytealg".
Remove this function and related tests.
Change-Id: I018a92902f881836699c6a90511359d8bfa16f80
GitHub-Last-Rev: d9c8917253d9e961798660ac62fa8e8ba35523bc
GitHub-Pull-Request: golang/go#78029
Reviewed-on: https://go-review.googlesource.com/c/go/+/753080
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Diffstat (limited to 'src/bytes/bytes_test.go')
| -rw-r--r-- | src/bytes/bytes_test.go | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/bytes/bytes_test.go b/src/bytes/bytes_test.go index 891aef2c8b..07280464d2 100644 --- a/src/bytes/bytes_test.go +++ b/src/bytes/bytes_test.go @@ -323,10 +323,6 @@ func TestIndexByte(t *testing.T) { if pos != tt.i { t.Errorf(`IndexByte(%q, '%c') = %v`, tt.a, b, pos) } - posp := IndexBytePortable(a, b) - if posp != tt.i { - t.Errorf(`indexBytePortable(%q, '%c') = %v`, tt.a, b, posp) - } } } @@ -617,8 +613,18 @@ func BenchmarkIndexByte(b *testing.B) { benchBytes(b, indexSizes, bmIndexByte(IndexByte)) } +// indexBytePortable use as the baseline for performance comparisons. +func indexBytePortable(s []byte, c byte) int { + for i, b := range s { + if b == c { + return i + } + } + return -1 +} + func BenchmarkIndexBytePortable(b *testing.B) { - benchBytes(b, indexSizes, bmIndexByte(IndexBytePortable)) + benchBytes(b, indexSizes, bmIndexByte(indexBytePortable)) } func bmIndexByte(index func([]byte, byte) int) func(b *testing.B, n int) { |
