netstar pushed a commit to branch master. http://git.enlightenment.org/apps/evisum.git/commit/?id=47a3078b060b07ca85827dbdac02788a7f41b1be
commit 47a3078b060b07ca85827dbdac02788a7f41b1be Author: Alastair Poole <nets...@gmail.com> Date: Sat Mar 13 15:30:44 2021 +0000 cache: .. --- src/bin/ui/ui_cache.c | 34 +++++++++++++++++++++------------- src/bin/ui/ui_process_list.c | 6 +++--- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/src/bin/ui/ui_cache.c b/src/bin/ui/ui_cache.c index 9aeb6f7..85d2945 100644 --- a/src/bin/ui/ui_cache.c +++ b/src/bin/ui/ui_cache.c @@ -51,16 +51,6 @@ evisum_ui_item_cache_steal(Evisum_Ui_Cache *cache, Eina_List *objs) free(it); } } - if (eina_list_count(cache->inactive)) return; - for (int i = 0; i < cache->size; i++) - { - Item_Cache *it = malloc(sizeof(Item_Cache)); - if (it) - { - it->obj = cache->item_create_cb(cache->parent); - cache->inactive = eina_list_prepend(cache->inactive, it); - } - } } Item_Cache * @@ -68,14 +58,32 @@ evisum_ui_item_cache_item_get(Evisum_Ui_Cache *cache) { Eina_List *l, *l_next; Item_Cache *it; + Eina_Bool clean; + int i = 0, n = eina_list_count(cache->inactive); + + clean = (n > 10) ? 1 : 0; EINA_LIST_FOREACH_SAFE(cache->inactive, l, l_next, it) { cache->inactive = eina_list_remove_list(cache->inactive, l); - cache->active = eina_list_prepend(cache->active, it); - return it; + if ((clean) && (i < 8)) + { + cache->pending = eina_list_prepend(cache->pending, it->obj); + free(it); + i++; + } + else + { + cache->active = eina_list_prepend(cache->active, it); + break; + } + it = NULL; } + if (clean) + evisum_ui_item_cache_pending_del(cache); + if (it) return it; + it = calloc(1, sizeof(Item_Cache)); if (it) { @@ -168,7 +176,7 @@ evisum_ui_item_cache_item_release(Evisum_Ui_Cache *cache, Evas_Object *obj) if (it->obj == obj) { cache->active = eina_list_remove_list(cache->active, l); - if (n >= 50) + if (n > 10) { evas_object_del(it->obj); free(it); diff --git a/src/bin/ui/ui_process_list.c b/src/bin/ui/ui_process_list.c index 8ba91d5..5b1f216 100644 --- a/src/bin/ui/ui_process_list.c +++ b/src/bin/ui/ui_process_list.c @@ -1005,10 +1005,10 @@ _process_list_feedback_cb(void *data, Ecore_Thread *thread EINA_UNUSED, eina_list_free(real); #endif -#if 0 - printf("active %d and inactive %d\n", +#if 1 + printf("active %d and inactive %d => %d (realized)\n", eina_list_count(pd->cache->active), - eina_list_count(pd->cache->inactive)); + eina_list_count(pd->cache->inactive), n); #endif if (!pd->poll_count) ecore_timer_add(1.0, _bring_in, pd); --