• Marcel van Lohuizen's avatar
    unicode/utf8: added benchmarks · 3d198bd7
    Marcel van Lohuizen authored
    Cover some functions that weren't benched before and add InString
    variants if the underlying implementation is different.
    
    Note: compare (Valid|RuneCount)InString* to their (Valid|RuneCount)*
    counterparts. It shows, somewhat unexpectedly, that ranging over
    a string is *much* slower than using calls to DecodeRune.
    
    Results:
    In order to avoid a discrepancy in measuring the performance
    of core we could leave the names of the string-based measurements
    unchanged and suffix the added alternatives with Bytes.
    
    Compared to old:
    BenchmarkRuneCountTenASCIIChars-8        44.3          12.4          -72.01%
    BenchmarkRuneCountTenJapaneseChars-8     167           67.1          -59.82%
    BenchmarkEncodeASCIIRune-8               3.37          3.44          +2.08%
    BenchmarkEncodeJapaneseRune-8            7.19          7.24          +0.70%
    BenchmarkDecodeASCIIRune-8               5.41          5.53          +2.22%
    BenchmarkDecodeJapaneseRune-8            8.17          8.41          +2.94%
    
    All benchmarks:
    BenchmarkRuneCountTenASCIIChars-8           	100000000	        12.4 ns/op
    BenchmarkRuneCountTenJapaneseChars-8        	20000000	        67.1 ns/op
    BenchmarkRuneCountInStringTenASCIIChars-8   	30000000	        44.5 ns/op
    BenchmarkRuneCountInStringTenJapaneseChars-8	10000000	       165 ns/op
    BenchmarkValidTenASCIIChars-8               	100000000	        12.5 ns/op
    BenchmarkValidTenJapaneseChars-8            	20000000	        71.1 ns/op
    BenchmarkValidStringTenASCIIChars-8         	30000000	        50.0 ns/op
    BenchmarkValidStringTenJapaneseChars-8      	10000000	       161 ns/op
    BenchmarkEncodeASCIIRune-8                  	500000000	         3.44 ns/op
    BenchmarkEncodeJapaneseRune-8               	200000000	         7.24 ns/op
    BenchmarkDecodeASCIIRune-8                  	300000000	         5.53 ns/op
    BenchmarkDecodeJapaneseRune-8               	200000000	         8.41 ns/op
    BenchmarkFullASCIIRune-8                    	500000000	         3.91 ns/op
    BenchmarkFullJapaneseRune-8                 	300000000	         4.22 ns/op
    
    Change-Id: I674d2ee4917b975a37717bbfa1082cc84dcd275e
    Reviewed-on: https://go-review.googlesource.com/14431Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    3d198bd7
Name
Last commit
Last update
..
archive Loading commit data...
bufio Loading commit data...
builtin Loading commit data...
bytes Loading commit data...
cmd Loading commit data...
compress Loading commit data...
container Loading commit data...
crypto Loading commit data...
database/sql Loading commit data...
debug Loading commit data...
encoding Loading commit data...
errors Loading commit data...
expvar Loading commit data...
flag Loading commit data...
fmt Loading commit data...
go Loading commit data...
hash Loading commit data...
html Loading commit data...
image Loading commit data...
index/suffixarray Loading commit data...
internal Loading commit data...
io Loading commit data...
log Loading commit data...
math Loading commit data...
mime Loading commit data...
net Loading commit data...
os Loading commit data...
path Loading commit data...
reflect Loading commit data...
regexp Loading commit data...
runtime Loading commit data...
sort Loading commit data...
strconv Loading commit data...
strings Loading commit data...
sync Loading commit data...
syscall Loading commit data...
testing Loading commit data...
text Loading commit data...
time Loading commit data...
unicode Loading commit data...
unsafe Loading commit data...
vendor/golang.org/x/net/http2/hpack Loading commit data...
Make.dist Loading commit data...
all.bash Loading commit data...
all.bat Loading commit data...
all.rc Loading commit data...
androidtest.bash Loading commit data...
bootstrap.bash Loading commit data...
buildall.bash Loading commit data...
clean.bash Loading commit data...
clean.bat Loading commit data...
clean.rc Loading commit data...
iostest.bash Loading commit data...
make.bash Loading commit data...
make.bat Loading commit data...
make.rc Loading commit data...
nacltest.bash Loading commit data...
race.bash Loading commit data...
race.bat Loading commit data...
run.bash Loading commit data...
run.bat Loading commit data...
run.rc Loading commit data...