From 51b2789a353b81e7fd89781acae782b34908985b Mon Sep 17 00:00:00 2001 From: "Carsten Haitzler (Rasterman)" Date: Thu, 3 Nov 2016 18:51:19 +0900 Subject: [PATCH] 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 --- src/lib/evas/common/language/evas_script_table.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/evas/common/language/evas_script_table.h b/src/lib/evas/common/language/evas_script_table.h index dd77db04e8..e89747436d 100644 --- a/src/lib/evas/common/language/evas_script_table.h +++ b/src/lib/evas/common/language/evas_script_table.h @@ -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 },