]> Cypherpunks repositories - gostls13.git/commit
exp/locale/collate: include composed characters into the table. This eliminates
authorMarcel van Lohuizen <mpvl@golang.org>
Mon, 24 Dec 2012 15:42:29 +0000 (16:42 +0100)
committerMarcel van Lohuizen <mpvl@golang.org>
Mon, 24 Dec 2012 15:42:29 +0000 (16:42 +0100)
commit9aa70984a95c24e7ced91432e0d780e6d2361679
treea9f1c642f524ddccaa0cbc40163e76b3e21e1be4
parent43f2fc308b92cec6071a4af225af1dafd4d7ba54
exp/locale/collate: include composed characters into the table. This eliminates
the need to decompose characters for the majority of cases.  This considerably
speeds up collation while increasing the table size minimally.

To detect non-normalized strings, rather than relying on exp/norm, the table
now includes CCC information. The inclusion of this information does not
increase table size.

DETAILS
 - Raw collation elements are now a struct that includes the CCC, rather
   than a slice of ints.
 - Builder now ensures that NFD and NFC counterparts are included in the table.
   This also fixes a bug for Korean which is responsible for most of the growth
   of the table size.
 - As there is no more normalization step, code should now handle both strings
   and byte slices as input. Introduced source type to facilitate this.

NOTES
 - This change does not handle normalization correctly entirely for contractions.
   This causes a few failures with the regtest. table_test.go contains a few
   uncommented tests that can be enabled once this is fixed.  The easiest is to
   fix this once we have the new norm.Iter.
 - Removed a test cases in table_test that covers cases that are now guaranteed
   to not exist.

R=rsc, mpvl
CC=golang-dev
https://golang.org/cl/6971044
16 files changed:
src/pkg/exp/locale/collate/build/builder.go
src/pkg/exp/locale/collate/build/builder_test.go
src/pkg/exp/locale/collate/build/colelem.go
src/pkg/exp/locale/collate/build/colelem_test.go
src/pkg/exp/locale/collate/build/order.go
src/pkg/exp/locale/collate/build/order_test.go
src/pkg/exp/locale/collate/colelem.go
src/pkg/exp/locale/collate/colelem_test.go
src/pkg/exp/locale/collate/collate.go
src/pkg/exp/locale/collate/collate_test.go
src/pkg/exp/locale/collate/contract.go
src/pkg/exp/locale/collate/export_test.go
src/pkg/exp/locale/collate/table.go
src/pkg/exp/locale/collate/table_test.go
src/pkg/exp/locale/collate/tables.go
src/pkg/exp/locale/collate/trie.go