Various Unicode-related speedups/robustness
Closed / Fixed3473670fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2012-01-14 09:28:50
Some ideas for improvements, noted while working on UTF-6.1 support. - The macro GetUniCharInfo() gets a byte from the pageMap and immediately shifts the value OFFSET_BITS to the left. We could as well put the shifted value in groupMap, that saves a bit shift for each character handled. - The macro GetDelta() is complicated because it compensates for compiler differences in handling sign extension. If we change the group[] array to use Bits 8-31 for the case delta, then we have enough bits for all possible Unicode characters, so sign extension can be compensated with using a mask 0x1fffff, or (when handling only the basic plane) casting to Tcl_UniChar - The tool uniParse.tcl makes assumptions about the content of UnicodeData.txt, but doesn't check those assumptions. It might be that future Unicode versions need more categories or case types, then the tool should warn us about that. In order to make Unicode-related table merges between the core branches possible, this is meant for all open core branches.
nijtmansplain2012-01-14 16:31:28
implemented in branch rfe-3473670
nijtmansplain2012-01-14 16:47:34
Needless to say: all tests pass with this change
hobbsplain2012-01-15 01:30:06
Did you test on both BE and LE machines?
nijtmansplain2012-01-15 21:54:57
>Did you test on both BE and LE machines? Goed question! No, I only tested on Windows and Ubuntu. However, the affectes macros and tables are only used in Unicode categories (like "string is control") or unicode case handling (like "string tolower"), it is not used in the Unicode encoding or anything which might be endian-dependant. So I am 100% confident that it will work on both LE and BE platforms. The affected functions in tclUtf.c all use Tcl_UniChar or int as internal data types, never (unsigned) char.
nijtmansplain2012-01-23 04:39:16
Updated the tools such that characters > 0xffff are handled as well, with #if's around it such that in the Basic Plane case everything is as before. This - again - allows for the same Unicode tables to be used in all branches, which simplifies the merging along branches when a new unicode version comes out.
nijtmansplain2012-01-23 05:02:16
Applied to core-8-4-branch, core-8-5-branch and trunk.
Log in (anonymous is fine) to add a comment.