summaryrefslogtreecommitdiff
path: root/src/lib/evas/cache2
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-06-26 16:31:38 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-07-02 16:58:10 +0900
commit096a8ece9f056236e915342eeadbcdf5dc025081 (patch)
treee76d4e79552a861a06cd519987aa95b6ce23099e /src/lib/evas/cache2
parent29bf164c75649b5f567a07ccb2f891c233c4c7e0 (diff)
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 <cedric.bail@samsung.com>
Diffstat (limited to 'src/lib/evas/cache2')
-rw-r--r--src/lib/evas/cache2/evas_cache2.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/lib/evas/cache2/evas_cache2.c b/src/lib/evas/cache2/evas_cache2.c
index 1e9b24fefb..f753233a51 100644
--- a/src/lib/evas/cache2/evas_cache2.c
+++ b/src/lib/evas/cache2/evas_cache2.c
@@ -30,6 +30,9 @@
30 */ 30 */
31#define HKEY_LOAD_OPTS_STR_LEN 215 31#define HKEY_LOAD_OPTS_STR_LEN 215
32 32
33// Default LRU size. If 0, all scaled images will be dropped instantly.
34#define DEFAULT_CACHE_LRU_SIZE (4*1024*1024)
35
33static void _evas_cache_image_dirty_add(Image_Entry *im); 36static void _evas_cache_image_dirty_add(Image_Entry *im);
34static void _evas_cache_image_dirty_del(Image_Entry *im); 37static void _evas_cache_image_dirty_del(Image_Entry *im);
35static void _evas_cache_image_activ_add(Image_Entry *im); 38static void _evas_cache_image_activ_add(Image_Entry *im);
@@ -484,12 +487,19 @@ on_error:
484EAPI Evas_Cache2 * 487EAPI Evas_Cache2 *
485evas_cache2_init(const Evas_Cache2_Image_Func *cb) 488evas_cache2_init(const Evas_Cache2_Image_Func *cb)
486{ 489{
490 char *env;
487 Evas_Cache2 *cache = calloc(1, sizeof(Evas_Cache2)); 491 Evas_Cache2 *cache = calloc(1, sizeof(Evas_Cache2));
488 492
489 cache->func = *cb; 493 cache->func = *cb;
490 cache->activ = eina_hash_string_superfast_new(NULL); 494 cache->activ = eina_hash_string_superfast_new(NULL);
491 cache->inactiv = eina_hash_string_superfast_new(NULL); 495 cache->inactiv = eina_hash_string_superfast_new(NULL);
492 496
497 env = getenv("EVAS_CSERVE2_SIZE");
498 if (env)
499 cache->limit = atoi(env) * 1024 * 1024;
500 if (!env || (cache->limit < 0))
501 cache->limit = DEFAULT_CACHE_LRU_SIZE;
502
493 return cache; 503 return cache;
494} 504}
495 505