edje: finally found why we did so many call to stat.
authorcedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 5 Jan 2012 14:31:27 +0000 (14:31 +0000)
committercedric <cedric@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 5 Jan 2012 14:31:27 +0000 (14:31 +0000)
NOTE: I am still wondering what is the cost difference between
forcing a request to eet_open and calling stat. If someone has some
time to benchmark, feel free to do so and report on e-devel ml.

git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@66902 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
NEWS
src/lib/edje_cache.c

index b066077..b042d09 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
        * Entry: Fixed undo/redo with IMF.
 
-2012-01-04 Carsten Haitzler (The Rasterman)
+2012-01-04  Carsten Haitzler (The Rasterman)
 
         * Add HEX, TERMINAL and PASSWORD layouts to edje
         * Add "recalc" smart callback for object size changes
+
+2012-01-05  Cedric Bail
+
+       * Reduce call to stat during edje_object_file_set.
diff --git a/NEWS b/NEWS
index c03f2d5..40f14cc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,7 @@ Additions:
 Improvements:
     * speedup load time of Edje file.
     * check existence of group at compile time also.
+    * reduce number of call to stat during edje_object_file_set.
 
 Changes since Edje 1.0.0:
 -------------------------
index a8b355f..0ce6b30 100644 (file)
@@ -128,18 +128,11 @@ _edje_file_coll_open(Edje_File *edf, const char *coll)
 }
 
 static Edje_File *
-_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret)
+_edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Collection **edc_ret, time_t mtime)
 {
    Edje_File *edf;
    Edje_Part_Collection *edc;
    Eet_File *ef;
-   struct stat st;
-
-   if (stat(file, &st) != 0)
-     {
-       *error_ret = EDJE_LOAD_ERROR_DOES_NOT_EXIST;
-       return NULL;
-     }
 
    ef = eet_open(file, EET_FILE_MODE_READ);
    if (!ef)
@@ -156,7 +149,7 @@ _edje_file_open(const char *file, const char *coll, int *error_ret, Edje_Part_Co
      }
 
    edf->ef = ef;
-   edf->mtime = st.st_mtime;
+   edf->mtime = mtime;
 
    if (edf->version != EDJE_FILE_VERSION)
      {
@@ -262,7 +255,7 @@ open_new:
    if (!_edje_file_hash)
       _edje_file_hash = eina_hash_string_small_new(NULL);
 
-   edf = _edje_file_open(file, coll, error_ret, edc_ret);
+   edf = _edje_file_open(file, coll, error_ret, edc_ret, st.st_mtime);
    if (!edf)
       return NULL;