go/src
Agniva De Sarker 65fbf0e834 strings: optimize ToLower
Handling the ASCII case inline and call unicode.ToLower only
for non-ASCII cases.

Gives good improvements for the ASCII case and minor perf
degrade for non-ASCII case

name                                     old time/op    new time/op    delta
ToLower/#00                                10.8ns ± 1%     9.0ns ± 1%  -16.83%  (p=0.008 n=5+5)
ToLower/abc                                23.3ns ± 4%    12.6ns ± 1%  -46.01%  (p=0.008 n=5+5)
ToLower/AbC123                             91.0ns ± 2%    70.4ns ± 0%  -22.59%  (p=0.008 n=5+5)
ToLower/azAZ09_                             104ns ± 3%      75ns ± 1%  -28.35%  (p=0.008 n=5+5)
ToLower/longStrinGwitHmixofsmaLLandcAps     254ns ± 4%     157ns ± 0%  -38.19%  (p=0.016 n=5+4)
ToLower/LONGⱯSTRINGⱯWITHⱯNONASCIIⱯCHARS     446ns ± 1%     451ns ± 1%     ~     (p=0.056 n=5+5)
ToLower/ⱭⱭⱭⱭⱭ                               345ns ± 1%     348ns ± 0%   +0.93%  (p=0.016 n=5+5)

name                                     old alloc/op   new alloc/op   delta
ToLower/#00                                 0.00B          0.00B          ~     (all equal)
ToLower/abc                                 0.00B          0.00B          ~     (all equal)
ToLower/AbC123                              16.0B ± 0%     16.0B ± 0%     ~     (all equal)
ToLower/azAZ09_                             24.0B ± 0%     16.0B ± 0%  -33.33%  (p=0.008 n=5+5)
ToLower/longStrinGwitHmixofsmaLLandcAps     80.0B ± 0%     64.0B ± 0%  -20.00%  (p=0.008 n=5+5)
ToLower/LONGⱯSTRINGⱯWITHⱯNONASCIIⱯCHARS     96.0B ± 0%     96.0B ± 0%     ~     (all equal)
ToLower/ⱭⱭⱭⱭⱭ                               48.0B ± 0%     48.0B ± 0%     ~     (all equal)

Ran on a machine with Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz

Fixes #17859

Change-Id: Iacc1e6b77e1aedba9447a6e94352606f131ea597
Reviewed-on: https://go-review.googlesource.com/76470
Reviewed-by: Marvin Stenger <marvin.stenger94@gmail.com>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
2017-11-08 21:47:19 +00:00
..
archive archive/tar: a cosmetic fix after checking by golint 2017-11-07 20:11:28 +00:00
bufio bufio: add Reader.Size and Writer.Size accessors 2017-11-02 17:17:44 +00:00
builtin
bytes bytes: reduce work in IndexNearPageBoundary test 2017-11-04 11:09:49 +00:00
cmd cmd/compile: optimize noding of long summation expressions 2017-11-08 21:34:57 +00:00
compress
container container/ring: fix example_test.go 2017-10-31 03:52:55 +00:00
context
crypto crypto/x509: enforce EKU nesting at chain-construction time. 2017-11-07 23:14:10 +00:00
database/sql all: change github.com issue links to golang.org 2017-11-04 04:13:41 +00:00
debug
encoding encoding/json: permit encoding uintptr as a string 2017-11-08 20:34:55 +00:00
errors
expvar
flag flag: add (*FlagSet).Name, (*FlagSet).ErrorHandling, export (*FlagSet).Output 2017-10-31 03:54:16 +00:00
fmt fmt: hide bad format in test from vet 2017-10-31 13:49:53 +00:00
go net: use WSASocket instead of socket call 2017-11-07 22:04:15 +00:00
hash hash: add marshaling, unmarshaling example 2017-11-04 03:47:34 +00:00
html
image all: change github.com issue links to golang.org 2017-11-04 04:13:41 +00:00
index/suffixarray
internal syscall: change SysProcAttr.Token type to Token 2017-11-07 22:06:35 +00:00
io io: fix Pipe regression with differing error types 2017-11-02 23:05:53 +00:00
log
math math/big: add security warning to (*Int).Rand 2017-11-06 15:55:31 +00:00
mime all: unindent some if bodies by exiting early 2017-10-31 20:07:46 +00:00
net net: use WSASocket instead of socket call 2017-11-07 22:04:15 +00:00
os syscall: fix NaCl Link syscall error handling 2017-11-06 16:36:34 +00:00
path
plugin
reflect all: unindent some if bodies by exiting early 2017-10-31 20:07:46 +00:00
regexp go/printer: forbid empty line before first comment in block 2017-11-02 18:17:22 +00:00
runtime runtime: flush assist credit on goroutine exit 2017-11-07 18:41:14 +00:00
sort
strconv
strings strings: optimize ToLower 2017-11-08 21:47:19 +00:00
sync all: change github.com issue links to golang.org 2017-11-04 04:13:41 +00:00
syscall syscall: change SysProcAttr.Token type to Token 2017-11-07 22:06:35 +00:00
testing
text all: unindent some if bodies by exiting early 2017-10-31 20:07:46 +00:00
time time: example in doc for time.AppendFormat func 2017-11-06 17:57:52 +00:00
unicode go/printer: forbid empty line before first comment in block 2017-11-02 18:17:22 +00:00
unsafe
vendor/golang_org/x vendor: add golang.org/x/crypto/cryptobyte 2017-11-08 00:18:05 +00:00
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash cmd/dist: fix bad LC_TIME assumption in 'date' invocation 2017-11-03 13:42:33 +00:00
make.bat build: quiet make.bash, make.bat, make.rc 2017-10-31 13:48:53 +00:00
make.rc build: quiet make.bash, make.bat, make.rc 2017-10-31 13:48:53 +00:00
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc