]> Cypherpunks.ru repositories - gostls13.git/commit
runtime: use bytes.IndexByte in findnull
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 14 Feb 2018 01:54:05 +0000 (17:54 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 1 Mar 2018 20:34:07 +0000 (20:34 +0000)
commit7365fac2dbd01960268ee051ed03d961258d4ef4
tree26075f6023cdf143f3e60c7329f4843a88f0577e
parent39fefa0709474d291af65af13bd2ac408ef5e9eb
runtime: use bytes.IndexByte in findnull

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 <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
misc/cgo/test/basic.go
misc/cgo/test/cgo_test.go
src/runtime/error.go
src/runtime/string.go