forked from enlightenment/efl
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>
This commit is contained in:
parent
29bf164c75
commit
096a8ece9f
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue