edje: another O(1) lookup, but for alias of group.

This give a small 10% benefit on Tizen theme.


SVN revision: 76428
This commit is contained in:
Cedric BAIL 2012-09-11 04:10:13 +00:00
parent 2127cab57d
commit b3739ac5d6
5 changed files with 15 additions and 13 deletions

View File

@ -609,3 +609,4 @@
2012-09-11 Cedric Bail
* O(1) lookup used when searching Part_Lookup in edje_cc.
* O(1) lookup when generating alias of group.

View File

@ -12,6 +12,7 @@ Additions:
Improvements:
* Check the number of parameter for image in edc.
* O(1) lookup used when searching Part_Lookup in edje_cc.
* O(1) lookup when generating alias of group.
Fixes:

View File

@ -240,6 +240,7 @@ extern Eina_List *stack;
extern Eina_List *params;
extern Edje_File *edje_file;
extern Eina_List *edje_collections;
extern Eina_Hash *edje_collections_lookup;
extern Eina_List *externals;
extern Eina_List *fonts;
extern Eina_List *codes;

View File

@ -1959,7 +1959,10 @@ static void
ob_collections(void)
{
if (!edje_file->collection)
edje_file->collection = eina_hash_string_small_new(NULL);
{
edje_file->collection = eina_hash_string_small_new(NULL);
edje_collections_lookup = eina_hash_int32_new(NULL);
}
}
/**
@ -2219,6 +2222,8 @@ ob_collections_group(void)
current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
current_de->id = eina_list_count(edje_collections);
eina_hash_add(edje_collections_lookup, &current_de->id, current_de);
pc = mem_alloc(SZ(Edje_Part_Collection));
edje_collections = eina_list_append(edje_collections, pc);
pc->id = current_de->id;

View File

@ -183,6 +183,7 @@ static void data_process_string(Edje_Part_Collection *pc, const char *prefix, ch
Edje_File *edje_file = NULL;
Eina_List *edje_collections = NULL;
Eina_Hash *edje_collections_lookup = NULL;
Eina_List *externals = NULL;
Eina_List *fonts = NULL;
Eina_List *codes = NULL;
@ -371,7 +372,6 @@ data_thread_head(void *data, Ecore_Thread *thread __UNUSED__)
EINA_LIST_FREE(aliases, ce)
{
Edje_Part_Collection_Directory_Entry *sce;
Eina_Iterator *it;
if (!ce->entry)
{
@ -381,18 +381,12 @@ data_thread_head(void *data, Ecore_Thread *thread __UNUSED__)
return;
}
it = eina_hash_iterator_data_new(edje_file->collection);
EINA_ITERATOR_FOREACH(it, sce)
sce = eina_hash_find(edje_collections_lookup, &ce->id);
if (sce)
{
if (ce->id == sce->id)
{
memcpy(&ce->count, &sce->count, sizeof (ce->count));
break;
}
memcpy(&ce->count, &sce->count, sizeof (ce->count));
}
if (!sce)
else
{
snprintf(buf, sizeof(buf),
"Collection %s (%i) can't find an correct alias.",
@ -400,7 +394,7 @@ data_thread_head(void *data, Ecore_Thread *thread __UNUSED__)
hw->errstr = strdup(buf);
return;
}
eina_iterator_free(it);
eina_hash_direct_add(edje_file->collection, ce->entry, ce);
}
}