1
0
mirror of https://github.com/golang/go synced 2024-11-20 05:14:41 -07:00
go/src
Ilya Tocar bc8bb5b27a unicode: speed-up is16/is32
Avoid division in common case. There are 5438 ranges in unicode/tables.go
4110 of them have stride 1.
Stride 1 case got significantly faster. Other stride is a bit slower.
Measured by

import (
	"testing"
	"unicode"
)

func BenchmarkDiv1(b *testing.B) {
	rtb := &unicode.RangeTable{
		R16: []unicode.Range16{
			{0xa800, 0xdfff, 1}, // or 3
		},
	}
	for i := 0; i < b.N; i++ {
		unicode.Is(rtb, rune(0xc700))
	}
}

Div1-6  15.6ns ± 1%   9.9ns ± 1%  -36.54%  (p=0.000 n=10+10)
Div3-6  15.5ns ± 1%  16.1ns ± 1%   +3.67%  (p=0.000 n=10+10)

Helps a bit with xml parsing from issue #21823

XMLsax-6   30.9s ± 0%   29.6s ± 0%  -4.15%  (p=0.000 n=10+9)

Change-Id: Ibac1a91d7b9474d0c134b0add83e56caa62daa20
Reviewed-on: https://go-review.googlesource.com/63390
Run-TryBot: Ilya Tocar <ilya.tocar@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-09-12 21:32:50 +00:00
..
archive archive/tar: populate Devmajor and Devminor in FileInfoHeader on Darwin 2017-09-01 10:25:54 +00:00
bufio
builtin builtin: use type aliases for rune and byte 2017-06-07 00:42:59 +00:00
bytes bytes: Add missing examples to functions 2017-08-25 20:50:58 +00:00
cmd cmd/compile: remove redundant switch label 2017-09-12 19:39:46 +00:00
compress compress/flate: remove non-standard extensions to flate 2017-08-31 03:30:43 +00:00
container
context runtime: improve timers scalability on multi-CPU systems 2017-09-12 16:52:23 +00:00
crypto crypto: simplify amd64 asm for sha{1,256,512} a bit 2017-09-12 18:06:37 +00:00
database/sql database/sql: fix Conn's doc typo 2017-09-08 13:49:40 +00:00
debug debug/macho: add missing file flags 2017-08-29 00:44:44 +00:00
encoding encoding/json: update documentation for MarshalIndent 2017-09-12 18:12:24 +00:00
errors
expvar expvar: make (*Map).Init clear existing keys 2017-09-11 21:31:51 +00:00
flag flag: simplify arg logic in parseOne 2017-09-05 20:31:44 +00:00
fmt fmt: document verbs %b %d %o %x %X for printing pointers 2017-08-28 05:11:30 +00:00
go go/*: use sort.Slice to simplify some code 2017-09-12 14:59:39 +00:00
hash
html
image
index/suffixarray
internal runtime: improve timers scalability on multi-CPU systems 2017-09-12 16:52:23 +00:00
io io/ioutil: don't cap buffer size in ReadFile 2017-08-31 19:32:18 +00:00
log log: move Ldate doc to general declaration 2017-09-10 09:44:30 +00:00
math math: fix Abs, Copysign and Signbit benchmarks 2017-09-09 16:52:16 +00:00
mime mime: ignore key on ParseMediaType when value don't pass RFC 2231 check 2017-08-29 21:10:56 +00:00
net net/http: allow reuse of http.Request objects 2017-09-11 23:10:06 +00:00
os os: don't assume /bin/pwd in test, find it in $PATH 2017-08-29 20:08:16 +00:00
path all: remove strings.Contains check around Replace 2017-09-12 08:58:28 +00:00
plugin runtime, plugin: error not throw on duplicate open 2017-09-09 16:26:33 +00:00
reflect cmd/compile: fix and improve struct field reflect information 2017-09-05 18:09:41 +00:00
regexp regexp: Remove duplicated function wordRune() 2017-09-08 23:39:37 +00:00
runtime runtime: optimize siftupTimer and siftdownTimer a bit 2017-09-12 17:25:00 +00:00
sort sort: add examples for IntsAreSorted, Float64s and Float64sAreSorted 2017-08-28 17:29:29 +00:00
strconv all: remove some double spaces from comments 2017-08-26 15:09:09 +00:00
strings
sync all: join some chained ifs to unindent code 2017-08-29 20:57:41 +00:00
syscall runtime: improve timers scalability on multi-CPU systems 2017-09-12 16:52:23 +00:00
testing testing: use time.Since instead of time.Now().Sub 2017-09-06 19:47:37 +00:00
text all: remove strings.Contains check around Replace 2017-09-12 08:58:28 +00:00
time runtime: improve timers scalability on multi-CPU systems 2017-09-12 16:52:23 +00:00
unicode unicode: speed-up is16/is32 2017-09-12 21:32:50 +00:00
unsafe all: remove some double spaces from comments 2017-08-26 15:09:09 +00:00
vendor/golang_org/x
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash misc/ios,src/iostest.bash: support GOIOS_DEVICE_ID 2017-08-28 16:37:25 +00:00
make.bash build: add go env GOROOT as default GOROOT_BOOTSTRAP value 2017-08-25 05:36:27 +00:00
make.bat
Make.dist
make.rc build: add go env GOROOT as default GOROOT_BOOTSTRAP value 2017-08-25 05:36:27 +00:00
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc