evas lang unicode tables - reduce memory by 24k+1324 bytes

so bu5hman pointed out a compile warning from clang that

 { 0x20000, 42711, EVAS_SCRIPT_HAN },

has 42711 exceeding a signed short. true. so this should be an
unsigned short. but this drew me to the fact the whole array could be
shorter by packing this short with the style memeber after it making
them pack into a nicely aligned 4 byte chunk next to the start unicode
value before it, thus chopping 1324 bytes off this table. even worse
the 8192 entry fast table above is using a full 32bits per entry where
they data they store is not even exceeding 7bits, so move this to an
unsigned char saving another 24k. this should reduce cache misses and
memory footprint and binary footprint of the evas .so files etc.

@fix + @optimize
This commit is contained in:
Carsten Haitzler 2016-11-03 18:51:19 +09:00
parent 4ed2e01591
commit 51b2789a35
1 changed files with 4 additions and 4 deletions

View File

@ -14,7 +14,7 @@
#define EVAS_SCRIPT_DIRECT_TABLE_LIMIT 8192
static const
Eina_Unicode _evas_script_fast_table[EVAS_SCRIPT_DIRECT_TABLE_LIMIT] = {
unsigned char _evas_script_fast_table[EVAS_SCRIPT_DIRECT_TABLE_LIMIT] = {
EVAS_SCRIPT_COMMON, EVAS_SCRIPT_COMMON, EVAS_SCRIPT_COMMON,
EVAS_SCRIPT_COMMON, EVAS_SCRIPT_COMMON, EVAS_SCRIPT_COMMON,
EVAS_SCRIPT_COMMON, EVAS_SCRIPT_COMMON, EVAS_SCRIPT_COMMON,
@ -2749,9 +2749,9 @@ Eina_Unicode _evas_script_fast_table[EVAS_SCRIPT_DIRECT_TABLE_LIMIT] = {
};
static const struct {
Eina_Unicode start;
short len;
Evas_Script_Type script;
Eina_Unicode start; // int - 4
unsigned short len; // short - 2
unsigned short script; // short 2 -- total. 8 bytes per entry
} _evas_script_slow_table[] = {
{ 0x2000, 12, EVAS_SCRIPT_COMMON },
{ 0x200c, 2, EVAS_SCRIPT_INHERITED },