cedric pushed a commit to branch master.
commit 096a8ece9f056236e915342eeadbcdf5dc025081
Author: Jean-Philippe Andre <[email protected]>
Date: Wed Jun 26 16:31:38 2013 +0900
evas/cserve2: Set default LRU size to 4Mb or env-based
The LRU should not be limited to 0 byte otherwise all scaled
images will be dropped and reloaded constantly, killing the
performance.
The size is inspired from the scalecache's size of 4Mb.
Variable: EVAS_CSERVE2_SIZE (number in Mb)
Signed-off-by: Cedric Bail <[email protected]>
---
src/lib/evas/cache2/evas_cache2.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/lib/evas/cache2/evas_cache2.c
b/src/lib/evas/cache2/evas_cache2.c
index 1e9b24f..f753233 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -30,6 +30,9 @@
*/
#define HKEY_LOAD_OPTS_STR_LEN 215
+// Default LRU size. If 0, all scaled images will be dropped instantly.
+#define DEFAULT_CACHE_LRU_SIZE (4*1024*1024)
+
static void _evas_cache_image_dirty_add(Image_Entry *im);
static void _evas_cache_image_dirty_del(Image_Entry *im);
static void _evas_cache_image_activ_add(Image_Entry *im);
@@ -484,12 +487,19 @@ on_error:
EAPI Evas_Cache2 *
evas_cache2_init(const Evas_Cache2_Image_Func *cb)
{
+ char *env;
Evas_Cache2 *cache = calloc(1, sizeof(Evas_Cache2));
cache->func = *cb;
cache->activ = eina_hash_string_superfast_new(NULL);
cache->inactiv = eina_hash_string_superfast_new(NULL);
+ env = getenv("EVAS_CSERVE2_SIZE");
+ if (env)
+ cache->limit = atoi(env) * 1024 * 1024;
+ if (!env || (cache->limit < 0))
+ cache->limit = DEFAULT_CACHE_LRU_SIZE;
+
return cache;
}
--
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev