1
0
mirror of https://github.com/golang/go synced 2024-11-24 01:40:12 -07:00
go/src
Joe Tsai 8eca08611a unicode/utf8: optimize ValidRune
Re-writing the switch statement as a single boolean expression
reduces the number of branches that the compiler generates.
It is also arguably easier to read as a pair of numeric ranges
that valid runes can exist in.

No test changes since the existing test does a good job of
testing all of the boundaries.

This change was to gain back some performance after a correctness
fix done in http://golang.org/cl/32123.

The correctness fix (CL/32123) slowed down the benchmarks slightly:
	benchmark                   old ns/op     new ns/op     delta
	BenchmarkIndexRune/10-4     19.3          21.6          +11.92%
	BenchmarkIndexRune/32-4     33.6          35.2          +4.76%

Since the fix relies on utf8.ValidRune, this CL improves benchmarks:
	benchmark                   old ns/op     new ns/op     delta
	BenchmarkIndexRune/10-4     21.6          20.0          -7.41%
	BenchmarkIndexRune/32-4     35.2          33.5          -4.83%

Change-Id: Ib1ca10a2e29c90e879a8ef9b7221c33e85d015d8
Reviewed-on: https://go-review.googlesource.com/32122
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-10-26 23:02:52 +00:00
..
archive archive/tar: validate sparse headers in parsePAX 2016-10-22 16:35:14 +00:00
bufio bufio: remove unnecessary "continue" 2016-10-24 14:49:44 +00:00
builtin
bytes bytes, strings: fix regression in IndexRune 2016-10-26 23:02:27 +00:00
cmd cmd/compile: avoid truncating fieldname var locations 2016-10-26 21:14:46 +00:00
compress all: minor vet fixes 2016-10-24 17:27:37 +00:00
container
context context: add comments to the WithCancel example, apply minor improvements 2016-10-26 22:35:07 +00:00
crypto crypto/x509: use Certificate.Equals and CertPool.contains. 2016-10-26 22:58:21 +00:00
database/sql database/sql: fix possible context leak in test 2016-10-24 17:56:11 +00:00
debug
encoding encoding/json: marshal the RawMessage value type the same as its pointer type 2016-10-26 21:03:00 +00:00
errors
expvar
flag flag: arrange for FlagSet.Usage to be non-nil by default 2016-10-26 16:13:40 +00:00
fmt fmt: document that unexported struct fields don't get the String/Error treatment 2016-10-26 13:56:45 +00:00
go go/scanner: recognize invalid floating-point constant exponent 2016-10-26 23:02:42 +00:00
hash
html html/template: add test case for unbounded template expansion 2016-10-24 15:44:30 +00:00
image image/color: improve speed of RGBA methods 2016-10-25 07:51:17 +00:00
index/suffixarray
internal syscall: use ERROR_IO_PENDING value in errnoErr 2016-10-22 23:05:01 +00:00
io
log all: freeze net/rpc and reword the 'frozen' message in other frozen packages 2016-10-26 16:11:07 +00:00
math math/cmplx: prevent infinite loop in tanSeries 2016-10-25 18:32:22 +00:00
mime
net net/http/httptest: doc tweaks 2016-10-26 22:55:05 +00:00
os os: consider only files from #M as regular on Plan 9 2016-10-26 16:18:00 +00:00
path path/filepath: make TestToNorm robust 2016-10-25 01:57:05 +00:00
plugin
reflect runtime: simplify reflectcall write barriers 2016-10-26 15:44:44 +00:00
regexp
runtime cmd/compile: avoid truncating fieldname var locations 2016-10-26 21:14:46 +00:00
sort
strconv
strings bytes, strings: fix regression in IndexRune 2016-10-26 23:02:27 +00:00
sync
syscall syscall: use name+(NN)FP on plan9/amd64 2016-10-25 22:13:35 +00:00
testing all: freeze net/rpc and reword the 'frozen' message in other frozen packages 2016-10-26 16:11:07 +00:00
text all: freeze net/rpc and reword the 'frozen' message in other frozen packages 2016-10-26 16:11:07 +00:00
time
unicode unicode/utf8: optimize ValidRune 2016-10-26 23:02:52 +00:00
unsafe
vendor/golang_org/x vendor/golang_org/x/crypto/curve25519: update to f62085100e1abe3d5c9b3b8c9a38d50b71323f64 2016-10-21 21:33:30 +00:00
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash
make.bat
Make.dist
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc