unicode/utf8: make acceptRanges bigger

This avoids bounds checks in the calling code.
The nominal increased size of the array in the binary
is compensated for by the decreased size of the functions that call it.

The benchmark changes are a bit scattered, but overall positive.

name                                 old time/op  new time/op  delta
RuneCountTenASCIIChars-8             8.86ns ± 4%  7.93ns ± 5%  -10.45%  (p=0.000 n=45+49)
RuneCountTenJapaneseChars-8          38.2ns ± 2%  37.2ns ± 1%   -2.63%  (p=0.000 n=44+41)
RuneCountInStringTenASCIIChars-8     7.82ns ± 2%  8.70ns ± 2%  +11.19%  (p=0.000 n=43+43)
RuneCountInStringTenJapaneseChars-8  39.3ns ± 9%  40.0ns ± 5%   +1.59%  (p=0.043 n=50+50)
ValidTenASCIIChars-8                 8.68ns ± 5%  8.74ns ± 5%     ~     (p=0.070 n=50+48)
ValidTenJapaneseChars-8              34.1ns ± 5%  36.8ns ± 4%   +8.09%  (p=0.000 n=45+50)
ValidStringTenASCIIChars-8           9.76ns ± 7%  8.33ns ± 3%  -14.59%  (p=0.000 n=48+47)
ValidStringTenJapaneseChars-8        37.7ns ± 8%  36.5ns ± 5%   -3.12%  (p=0.011 n=50+47)
EncodeASCIIRune-8                    2.60ns ± 1%  2.59ns ± 2%   -0.24%  (p=0.018 n=43+36)
EncodeJapaneseRune-8                 3.75ns ± 2%  4.56ns ± 6%  +21.71%  (p=0.000 n=41+50)
DecodeASCIIRune-8                    2.59ns ± 2%  2.59ns ± 2%     ~     (p=0.350 n=44+41)
DecodeJapaneseRune-8                 4.29ns ± 2%  4.31ns ± 2%   +0.61%  (p=0.001 n=48+39)
FullASCIIRune-8                      0.87ns ± 6%  0.29ns ± 5%  -67.31%  (p=0.000 n=49+43)
FullJapaneseRune-8                   0.65ns ± 6%  0.65ns ± 4%     ~     (p=0.375 n=50+49)
[Geo mean]                           7.02ns       6.51ns        -7.19%


Change-Id: I8d5d69c8d33ce2bff94785fba39a2203f9315cb0
Reviewed-on: https://go-review.googlesource.com/c/go/+/173537
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
1 file changed
tree: b08709c509c645795ff0f06a4341d6c184036e05
  1. .github/
  2. api/
  3. doc/
  4. lib/
  5. misc/
  6. src/
  7. test/
  8. .gitattributes
  9. .gitignore
  10. AUTHORS
  11. CONTRIBUTING.md
  12. CONTRIBUTORS
  13. favicon.ico
  14. LICENSE
  15. PATENTS
  16. README.md
  17. robots.txt
README.md

The Go Programming Language

Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.

Gopher image Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.

Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.

Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.

Download and Install

Binary Distributions

Official binary distributions are available at https://golang.org/dl/.

After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.

Install From Source

If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.

Contributing

Go is the work of thousands of contributors. We appreciate your help!

To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html

Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.