From 7365fac2dbd01960268ee051ed03d961258d4ef4 Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 13 Feb 2018 17:54:05 -0800 Subject: runtime: use bytes.IndexByte in findnull MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bytes.IndexByte is heavily optimized. Use it in findnull. name old time/op new time/op delta GoString-8 65.5ns ± 1% 40.2ns ± 1% -38.62% (p=0.000 n=19+19) findnull is also used in gostringnocopy, which is used in many hot spots in the runtime. Fixes #23830 Change-Id: I2e6cb279c7d8078f8844065de684cc3567fe89d7 Reviewed-on: https://go-review.googlesource.com/97523 Run-TryBot: Josh Bleecher Snyder Reviewed-by: Brad Fitzpatrick Reviewed-by: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/runtime/error.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/runtime/error.go') diff --git a/src/runtime/error.go b/src/runtime/error.go index e1291e1543..2435f98b7a 100644 --- a/src/runtime/error.go +++ b/src/runtime/error.go @@ -121,6 +121,7 @@ func printany(i interface{}) { // strings.IndexByte is implemented in runtime/asm_$goarch.s // but amusingly we need go:linkname to get access to it here in the runtime. //go:linkname stringsIndexByte strings.IndexByte +//go:noescape func stringsIndexByte(s string, c byte) int // panicwrap generates a panic for a call to a wrapped value method -- cgit v1.3-5-g9baa