From: cedric Date: Thu, 5 Jan 2012 14:31:27 +0000 (+0000) Subject: edje: finally found why we did so many call to stat. X-Git-Tag: submit/trunk/20120815.180907~297 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=10fa427e9207d80518ec473ff3254af0f71aae2d;p=profile%2Fivi%2Fedje.git edje: finally found why we did so many call to stat. 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: http://svn.enlightenment.org/svn/e/trunk/edje@66902 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/ChangeLog b/ChangeLog index b066077..b042d09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -258,7 +258,11 @@ * 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 --- 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: ------------------------- diff --git a/src/lib/edje_cache.c b/src/lib/edje_cache.c index a8b355f..0ce6b30 100644 --- a/src/lib/edje_cache.c +++ b/src/lib/edje_cache.c @@ -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;