summaryrefslogtreecommitdiff
path: root/src/strings/compare_test.go
Commit message (Collapse)AuthorAgeFilesLines
* strings: lower running time of TestCompareStringsKeith Randall2018-11-041-3/+10
| | | | | | | | | | | | | | | | | | At each comparison, we're making a copy of the whole string. Instead, use unsafe to share the string backing store with a []byte. It reduces the test time from ~4sec to ~1sec on my machine (darwin/amd64). Some builders were having much more trouble with this test (>3min), it may help more there. Fixes #26174 Fixes #28573 Fixes #26155 Update #26473 Change-Id: Id5856fd26faf6ff46e763a088f039230556a4116 Reviewed-on: https://go-review.googlesource.com/c/147358 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* strings: do much less redundant testing in TestCompareStringsIan Lance Taylor2018-07-021-4/+7
| | | | | | | | | | | | | | | | | | On the OpenBSD builder this reduces the test time from 213 seconds to 60 seconds, without loss of testing. Not sure why the test is so much slower on OpenBSD, so not closing the issues. Updates #26155 Updates #26174 Change-Id: I13b58bbe3b209e591c308765077d2342943a3d2a Reviewed-on: https://go-review.googlesource.com/121820 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ralph Corderoy <ralph@inputplus.co.uk> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* bytes, strings: fix comparison of long byte slices on s390xbill_ofarrell2018-06-291-2/+13
| | | | | | | | | | | | | The existing implementation of bytes.Compare on s390x doesn't work properly for slices longer than 256 elements. This change fixes that. Added tests for long strings and slices of bytes. Fixes #26114 Change-Id: If6d8b68ee6dbcf99a24f867a1d3438b1f208954f Reviewed-on: https://go-review.googlesource.com/121495 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* all: single space after period.Brad Fitzpatrick2016-03-021-1/+1
| | | | | | | | | | | | | | | | | | | | The tree's pretty inconsistent about single space vs double space after a period in documentation. Make it consistently a single space, per earlier decisions. This means contributors won't be confused by misleading precedence. This CL doesn't use go/doc to parse. It only addresses // comments. It was generated with: $ perl -i -npe 's,^(\s*// .+[a-z]\.) +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.) +([A-Z])') $ go test go/doc -update Change-Id: Iccdb99c37c797ef1f804a94b22ba5ee4b500c4f7 Reviewed-on: https://go-review.googlesource.com/20022 Reviewed-by: Rob Pike <r@golang.org> Reviewed-by: Dave Day <djd@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
* strings: add Compare(x, y string) int, for symmetry with bytes.CompareAlan Donovan2015-01-151-0/+98
The implementation is the same assembly (or Go) routine. Change-Id: Ib937c461c24ad2d5be9b692b4eed40d9eb031412 Reviewed-on: https://go-review.googlesource.com/2828 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>