cedric pushed a commit to branch master.

commit 072f73a453185ac8e2c4913ea266d9e4cc672e08
Author: Cedric Bail <[email protected]>
Date:   Thu Aug 1 10:51:52 2013 +0900

    edje: improve loading time of Edje_Object with Evas_Object_Textblock and 
multiple styles.
    
    This bring you a 10% speedup to the first frame of Elementary_Test.
---
 ChangeLog                            |  4 ++++
 NEWS                                 |  1 +
 src/lib/edje/edje_private.h          |  3 +++
 src/lib/edje/edje_textblock_styles.c | 16 +++++++++-------
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 40ff74b..0c2c627 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-08-01  Cedric Bail
+
+       * Edje: faster load time for Edje_Object using Evas_Object_Textblocks 
and many styles.
+
 2013-07-31  Carsten Haitzler (The Rasterman)
 
         * Fix efl to use key not keyname (so xmodmap works).
diff --git a/NEWS b/NEWS
index 776442f..a1dfab0 100644
--- a/NEWS
+++ b/NEWS
@@ -124,6 +124,7 @@ Additions:
      - support edc proxy.source_visible, proxy.source_clip
      - support edc map color set
      - Add threshold support to Edje draggable part.
+     - Reduce load time of Edje_Object using Evas_Object_Textblock and many 
styles.
     * Eeze:
      - Add a dummy libmount replacement for when libmount is not there.
     * Ecore_Con:
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 20124b4..8f587e2 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -462,6 +462,7 @@ struct _Edje_File
    Edje_External_Directory        *external_dir;
    Edje_Image_Directory           *image_dir;
    Edje_Sound_Directory           *sound_dir;
+
    Eina_List                      *styles;
 
    Eina_List                      *color_classes;
@@ -501,6 +502,8 @@ struct _Edje_Style
    char                           *name;
    Eina_List                      *tags;
    Evas_Textblock_Style           *style;
+
+   Eina_Bool                       cache;
 };
 
 struct _Edje_Style_Tag
diff --git a/src/lib/edje/edje_textblock_styles.c 
b/src/lib/edje/edje_textblock_styles.c
index 32fa677..8b2b21f 100644
--- a/src/lib/edje/edje_textblock_styles.c
+++ b/src/lib/edje/edje_textblock_styles.c
@@ -173,6 +173,9 @@ _edje_textblock_style_all_update(Edje *ed)
         /* Make sure the style is already defined */
         if (!stl->style) break;
 
+        /* No need to compute it again and again and again */
+       if (stl->cache) continue;
+
         /* Make sure the style contains a text_class */
         EINA_LIST_FOREACH(stl->tags, ll, tag)
           {
@@ -257,6 +260,7 @@ _edje_textblock_style_all_update(Edje *ed)
         if (fontsource) free(fontsource);
 
         /* Configure the style */
+        stl->cache = EINA_TRUE;
         evas_textblock_style_set(stl->style, eina_strbuf_string_get(txt));
         eina_strbuf_reset(txt);
      }
@@ -401,18 +405,16 @@ _edje_textblock_style_parse_and_fix(Edje_File *edf)
 void
 _edje_textblock_style_cleanup(Edje_File *edf)
 {
-   while (edf->styles)
+   Edje_Style *stl;
+
+   EINA_LIST_FREE(edf->styles, stl)
      {
-       Edje_Style *stl;
+        Edje_Style_Tag *tag;
 
-       stl = edf->styles->data;
-       edf->styles = eina_list_remove_list(edf->styles, edf->styles);
-       while (stl->tags)
+        EINA_LIST_FREE(stl->tags, tag)
          {
             Edje_Style_Tag *tag;
 
-            tag = stl->tags->data;
-            stl->tags = eina_list_remove_list(stl->tags, stl->tags);
             if (tag->value && 
eet_dictionary_string_check(eet_dictionary_get(edf->ef), tag->value) == 0)
                eina_stringshare_del(tag->value);
              if (edf->free_strings)

-- 

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

Reply via email to