summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2012-09-11 04:10:13 +0000
committerCedric BAIL <cedric.bail@free.fr>2012-09-11 04:10:13 +0000
commitb3739ac5d6aaee5416134fd2ce466ecfedb31425 (patch)
treeaa9e61d919a6c9abf68c96394416c6baf6fe00dd
parent2127cab57dceaf896a8177d0c331b3d5e6091210 (diff)
edje: another O(1) lookup, but for alias of group.
This give a small 10% benefit on Tizen theme. SVN revision: 76428
-rw-r--r--legacy/edje/ChangeLog1
-rw-r--r--legacy/edje/NEWS1
-rw-r--r--legacy/edje/src/bin/edje_cc.h1
-rw-r--r--legacy/edje/src/bin/edje_cc_handlers.c7
-rw-r--r--legacy/edje/src/bin/edje_cc_out.c18
5 files changed, 15 insertions, 13 deletions
diff --git a/legacy/edje/ChangeLog b/legacy/edje/ChangeLog
index 746a195d36..5eefd0efd7 100644
--- a/legacy/edje/ChangeLog
+++ b/legacy/edje/ChangeLog
@@ -609,3 +609,4 @@
6092012-09-11 Cedric Bail 6092012-09-11 Cedric Bail
610 610
611 * O(1) lookup used when searching Part_Lookup in edje_cc. 611 * O(1) lookup used when searching Part_Lookup in edje_cc.
612 * O(1) lookup when generating alias of group.
diff --git a/legacy/edje/NEWS b/legacy/edje/NEWS
index bb466489ee..9a9e8795af 100644
--- a/legacy/edje/NEWS
+++ b/legacy/edje/NEWS
@@ -12,6 +12,7 @@ Additions:
12Improvements: 12Improvements:
13 * Check the number of parameter for image in edc. 13 * Check the number of parameter for image in edc.
14 * O(1) lookup used when searching Part_Lookup in edje_cc. 14 * O(1) lookup used when searching Part_Lookup in edje_cc.
15 * O(1) lookup when generating alias of group.
15 16
16Fixes: 17Fixes:
17 18
diff --git a/legacy/edje/src/bin/edje_cc.h b/legacy/edje/src/bin/edje_cc.h
index 4c5ec0629e..e7fb7a4723 100644
--- a/legacy/edje/src/bin/edje_cc.h
+++ b/legacy/edje/src/bin/edje_cc.h
@@ -240,6 +240,7 @@ extern Eina_List *stack;
240extern Eina_List *params; 240extern Eina_List *params;
241extern Edje_File *edje_file; 241extern Edje_File *edje_file;
242extern Eina_List *edje_collections; 242extern Eina_List *edje_collections;
243extern Eina_Hash *edje_collections_lookup;
243extern Eina_List *externals; 244extern Eina_List *externals;
244extern Eina_List *fonts; 245extern Eina_List *fonts;
245extern Eina_List *codes; 246extern Eina_List *codes;
diff --git a/legacy/edje/src/bin/edje_cc_handlers.c b/legacy/edje/src/bin/edje_cc_handlers.c
index b30f621d3b..6e10cce764 100644
--- a/legacy/edje/src/bin/edje_cc_handlers.c
+++ b/legacy/edje/src/bin/edje_cc_handlers.c
@@ -1959,7 +1959,10 @@ static void
1959ob_collections(void) 1959ob_collections(void)
1960{ 1960{
1961 if (!edje_file->collection) 1961 if (!edje_file->collection)
1962 edje_file->collection = eina_hash_string_small_new(NULL); 1962 {
1963 edje_file->collection = eina_hash_string_small_new(NULL);
1964 edje_collections_lookup = eina_hash_int32_new(NULL);
1965 }
1963} 1966}
1964 1967
1965/** 1968/**
@@ -2219,6 +2222,8 @@ ob_collections_group(void)
2219 current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry)); 2222 current_de = mem_alloc(SZ(Edje_Part_Collection_Directory_Entry));
2220 current_de->id = eina_list_count(edje_collections); 2223 current_de->id = eina_list_count(edje_collections);
2221 2224
2225 eina_hash_add(edje_collections_lookup, &current_de->id, current_de);
2226
2222 pc = mem_alloc(SZ(Edje_Part_Collection)); 2227 pc = mem_alloc(SZ(Edje_Part_Collection));
2223 edje_collections = eina_list_append(edje_collections, pc); 2228 edje_collections = eina_list_append(edje_collections, pc);
2224 pc->id = current_de->id; 2229 pc->id = current_de->id;
diff --git a/legacy/edje/src/bin/edje_cc_out.c b/legacy/edje/src/bin/edje_cc_out.c
index 812434db77..fa68d38db9 100644
--- a/legacy/edje/src/bin/edje_cc_out.c
+++ b/legacy/edje/src/bin/edje_cc_out.c
@@ -183,6 +183,7 @@ static void data_process_string(Edje_Part_Collection *pc, const char *prefix, ch
183 183
184Edje_File *edje_file = NULL; 184Edje_File *edje_file = NULL;
185Eina_List *edje_collections = NULL; 185Eina_List *edje_collections = NULL;
186Eina_Hash *edje_collections_lookup = NULL;
186Eina_List *externals = NULL; 187Eina_List *externals = NULL;
187Eina_List *fonts = NULL; 188Eina_List *fonts = NULL;
188Eina_List *codes = NULL; 189Eina_List *codes = NULL;
@@ -371,7 +372,6 @@ data_thread_head(void *data, Ecore_Thread *thread __UNUSED__)
371 EINA_LIST_FREE(aliases, ce) 372 EINA_LIST_FREE(aliases, ce)
372 { 373 {
373 Edje_Part_Collection_Directory_Entry *sce; 374 Edje_Part_Collection_Directory_Entry *sce;
374 Eina_Iterator *it;
375 375
376 if (!ce->entry) 376 if (!ce->entry)
377 { 377 {
@@ -381,18 +381,12 @@ data_thread_head(void *data, Ecore_Thread *thread __UNUSED__)
381 return; 381 return;
382 } 382 }
383 383
384 it = eina_hash_iterator_data_new(edje_file->collection); 384 sce = eina_hash_find(edje_collections_lookup, &ce->id);
385 385 if (sce)
386 EINA_ITERATOR_FOREACH(it, sce)
387 { 386 {
388 if (ce->id == sce->id) 387 memcpy(&ce->count, &sce->count, sizeof (ce->count));
389 {
390 memcpy(&ce->count, &sce->count, sizeof (ce->count));
391 break;
392 }
393 } 388 }
394 389 else
395 if (!sce)
396 { 390 {
397 snprintf(buf, sizeof(buf), 391 snprintf(buf, sizeof(buf),
398 "Collection %s (%i) can't find an correct alias.", 392 "Collection %s (%i) can't find an correct alias.",
@@ -400,7 +394,7 @@ data_thread_head(void *data, Ecore_Thread *thread __UNUSED__)
400 hw->errstr = strdup(buf); 394 hw->errstr = strdup(buf);
401 return; 395 return;
402 } 396 }
403 eina_iterator_free(it); 397
404 eina_hash_direct_add(edje_file->collection, ce->entry, ce); 398 eina_hash_direct_add(edje_file->collection, ce->entry, ce);
405 } 399 }
406 } 400 }