From 936b977c174dd66348bacd1392f761ae518ca7c1 Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Fri, 3 Nov 2017 21:57:08 -0700 Subject: [PATCH] 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 TryBot-Result: Gobot Gobot Reviewed-by: Russ Cox --- src/bytes/boundary_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/bytes/boundary_test.go b/src/bytes/boundary_test.go index f9e20e36c7..ea84f1e40f 100644 --- a/src/bytes/boundary_test.go +++ b/src/bytes/boundary_test.go @@ -67,6 +67,10 @@ func TestIndexNearPageBoundary(t *testing.T) { t.Parallel() var q [64]byte b := dangerousSlice(t) + if len(b) > 256 { + // Only worry about when we're near the end of a page. + b = b[len(b)-256:] + } for j := 1; j < len(q); j++ { q[j-1] = 1 // difference is only found on the last byte for i := range b { -- 2.48.1