• Marcel van Lohuizen's avatar
    unicode/utf8: removed uses of ranging over string · 9b299c1e
    Marcel van Lohuizen authored
    Ranging over string is much slower than using DecodeRuneInString.
    See golang.org/issue/13162.
    
    Replacing ranging over a string with the implementation of the Bytes
    counterpart results in the following performance improvements:
    
    RuneCountInStringTenASCIIChars-8     43.0ns ± 1%  16.4ns ± 2%  -61.80%  (p=0.000 n=7+8)
    RuneCountInStringTenJapaneseChars-8   161ns ± 2%   154ns ± 2%   -4.58%  (p=0.000 n=8+8)
    ValidStringTenASCIIChars-8           52.2ns ± 1%  13.2ns ± 1%  -74.62%  (p=0.001 n=7+7)
    ValidStringTenJapaneseChars-8         173ns ± 2%   153ns ± 2%  -11.78%  (p=0.000 n=7+8)
    
    Update golang/go#13162
    
    Change-Id: Ifc40a6a94bb3317f1f2d929d310bd2694645e9f6
    Reviewed-on: https://go-review.googlesource.com/16695Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    9b299c1e
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...