Skip to content

Commit 936b977

Browse files
randall77rsc
authored andcommitted
bytes: reduce work in IndexNearPageBoundary test
This test was taking too long on ppc64x. There were a few reasons. The first is that the page size on ppc64x is 64k instead of 4k. That's 16x more work. The second is that the generic Index is pretty bad in this case. It first calls IndexByte which does a bunch of setup work only to find the byte we're looking for at index 0. Then it calls Equal which has to look at the whole string to find a difference on the last byte. To fix, just limit our attention to near the end of the page. Change-Id: I6b8bcbb94652a2da853862acc23803def0c49303 Reviewed-on: https://go-review.googlesource.com/76050 Run-TryBot: Keith Randall <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Russ Cox <[email protected]>
1 parent 33a9f01 commit 936b977

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bytes/boundary_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ func TestIndexNearPageBoundary(t *testing.T) {
6767
t.Parallel()
6868
var q [64]byte
6969
b := dangerousSlice(t)
70+
if len(b) > 256 {
71+
// Only worry about when we're near the end of a page.
72+
b = b[len(b)-256:]
73+
}
7074
for j := 1; j < len(q); j++ {
7175
q[j-1] = 1 // difference is only found on the last byte
7276
for i := range b {

0 commit comments

Comments
 (0)