cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=efbc90ff87dd75c9887ba4d11837920d25270162

commit efbc90ff87dd75c9887ba4d11837920d25270162
Author: Cedric BAIL <[email protected]>
Date:   Fri Oct 25 08:00:23 2019 -0700

    eina: make use of the new near allocation policy for Eina_List.
    
    The idea is to improve memory locality and hopefully get better cache hit
    in general.
    
    Reviewed-by: Mike Blumenkrantz <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D10536
---
 src/lib/eina/eina_list.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/eina/eina_list.c b/src/lib/eina/eina_list.c
index 844e387293..d81bf6cb63 100644
--- a/src/lib/eina/eina_list.c
+++ b/src/lib/eina/eina_list.c
@@ -213,11 +213,11 @@ _eina_list_mempool_accounting_free(Eina_List_Accounting 
*accounting)
 }
 
 static inline Eina_List *
-_eina_list_mempool_list_new(EINA_UNUSED Eina_List *list)
+_eina_list_mempool_list_new(Eina_List *before, Eina_List *after)
 {
    Eina_List *tmp;
 
-   tmp = eina_mempool_malloc(_eina_list_mp, sizeof (Eina_List));
+   tmp = eina_mempool_malloc_near(_eina_list_mp, before, after, sizeof 
(Eina_List));
    if (!tmp)
      return NULL;
 #ifdef EINA_LIST_MAGIC
@@ -585,7 +585,7 @@ eina_list_append(Eina_List *list, const void *data)
 {
    Eina_List *l, *new_l;
 
-   new_l = _eina_list_mempool_list_new(list);
+   new_l = _eina_list_mempool_list_new(NULL, list);
    if (!new_l) return list;
 
    new_l->next = NULL;
@@ -619,7 +619,7 @@ eina_list_prepend(Eina_List *list, const void *data)
 {
    Eina_List *new_l;
 
-   new_l = _eina_list_mempool_list_new(list);
+   new_l = _eina_list_mempool_list_new(list, NULL);
    if (!new_l) return list;
 
    new_l->prev = NULL;
@@ -680,7 +680,7 @@ eina_list_append_relative_list(Eina_List *list,
    EINA_MAGIC_CHECK_LIST(relative, NULL);
 #endif
 
-   new_l = _eina_list_mempool_list_new(list);
+   new_l = _eina_list_mempool_list_new(relative, relative->next);
    if (!new_l) return list;
 
    new_l->next = relative->next;
@@ -733,7 +733,7 @@ eina_list_prepend_relative_list(Eina_List *list,
 #ifdef EINA_LIST_MAGIC
    EINA_MAGIC_CHECK_LIST(relative, NULL);
 #endif
-   new_l = _eina_list_mempool_list_new(list);
+   new_l = _eina_list_mempool_list_new(relative->prev, relative);
    if (!new_l) return list;
 
    new_l->prev = relative->prev;

-- 


Reply via email to