]> Cypherpunks repositories - gostls13.git/commit
unicode: performance improvements (API change)
authorRuss Cox <rsc@golang.org>
Fri, 21 Sep 2012 04:35:25 +0000 (00:35 -0400)
committerRuss Cox <rsc@golang.org>
Fri, 21 Sep 2012 04:35:25 +0000 (00:35 -0400)
commit4591cd631dad588c8fb40097021d1c63860aa4ad
treeedb9d86e634d257e088b9ed6320172090c6b532c
parent31758b2c1a4fef9c387d039190e55c640bda9408
unicode: performance improvements (API change)

*** There is an API change here: the introduction of the
LatinOffset int in the RangeTable struct. ***

* Avoid checking Latin range multiple times for non-Latin runes.
* Use linear search when it is faster than binary search.

go test -calibrate runs the calibration for where the linear/binary
crossover should be.

benchmark                       old MB/s     new MB/s  speedup
BenchmarkFields            36.27        41.43    1.14x
BenchmarkFieldsFunc        36.23        41.38    1.14x

The speedup here is evenly split between the linear scans
and the LatinOffset change. Both are about 1.07x.

R=r
CC=bradfitz, gobot, golang-dev
https://golang.org/cl/6526048
src/pkg/unicode/digit.go
src/pkg/unicode/graphic.go
src/pkg/unicode/letter.go
src/pkg/unicode/letter_test.go
src/pkg/unicode/maketables.go
src/pkg/unicode/tables.go