1
0
mirror of https://github.com/golang/go synced 2024-10-05 06:21:24 -06:00
go/src/pkg/exp/norm
Marcel van Lohuizen cfcc3ebfa4 exp/norm: changed API of Iter.
Motivations:
 - Simpler UI. Previous API proved a bit awkward for practical purposes.
 - Iter is often used in cases where one want to be able to bail out early.
   The old implementaton had too much look-ahead to be efficient.
Disadvantages:
 - ASCII performance is bad. This is unavoidable for tiny iterations.
   Example is included to show how to work around this.

Description:
Iter now iterates per boundary/segment. It returns a slice of bytes that
either points to the input bytes, the internal decomposition strings,
or the small internal buffer that each iterator has. In many cases, copying
bytes is avoided.
The method Seek was added to support jumping around the input without
having to reinitialize.

Details:
 - Table adjustments: some decompositions exist of multiple segments.
   Decompositions that are of this type are now marked so that Iter can
   handle them separately.
 - The old iterator had a different next function for different normal forms
   that was assigned to a function pointer called by Next.
   The new iterator uses this mechanism to switch between different modes
   for handling different type of input as well.  This greatly improves
   performance for Hangul and ASCII. It is also used for multi-segment
   decompositions.
 - input is now a struct of sting and []byte, instead of an interface.
   This simplifies optimizing the ASCII case.

R=rsc
CC=golang-dev
https://golang.org/cl/6873072
2012-12-24 16:53:25 +01:00
..
composition_test.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
composition.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
example_iter_test.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
forminfo.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
input.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
iter_test.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
iter.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
Makefile build: remove Make.pkg, Make.tool 2012-01-30 23:43:46 -05:00
maketables.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
maketesttables.go gofmt: apply gofmt -w src misc 2012-10-30 13:38:01 -07:00
norm_test.go
normalize_test.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
normalize.go exp/norm: exposed runeInfo type in API. 2012-04-11 16:47:53 +02:00
normregtest.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
readwriter_test.go
readwriter.go
tables.go exp/norm: changed API of Iter. 2012-12-24 16:53:25 +01:00
trie_test.go exp/locale/collate: fixed two bugs uncovered by regression tests. 2012-05-02 17:01:41 +02:00
trie.go exp/locale/collate: fixed two bugs uncovered by regression tests. 2012-05-02 17:01:41 +02:00
triedata_test.go exp/locale/collate: fixed two bugs uncovered by regression tests. 2012-05-02 17:01:41 +02:00
triegen.go all: fix typos 2012-12-19 03:04:09 +08:00