Enlightenment CVS committal

Author  : raster
Project : e17
Module  : libs/evas

Dir     : e17/libs/evas/src/lib/data


Modified Files:
        evas_list.c 


Log Message:


i'm playign with memory pools for evas lists. it seems to improve things.

===================================================================
RCS file: /cvsroot/enlightenment/e17/libs/evas/src/lib/data/evas_list.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -3 -r1.16 -r1.17
--- evas_list.c 22 Jul 2005 10:28:10 -0000      1.16
+++ evas_list.c 23 Nov 2005 10:43:54 -0000      1.17
@@ -14,6 +14,20 @@
 
 static int _evas_list_alloc_error = 0;
 
+static Evas_Mempool _evas_list_mempool =
+{
+   sizeof(Evas_List),
+   (4096 - (34 * sizeof(int)) - (sizeof(void *) * 2)) / sizeof(Evas_List),
+// 32,
+   0, NULL
+};
+static Evas_Mempool _evas_list_accounting_mempool =
+{
+   sizeof(Evas_List_Accounting),
+   32,
+   0, NULL
+};
+   
 /**
  * @defgroup Evas_List_Data_Group Linked List Creation Functions
  *
@@ -52,7 +66,7 @@
    Evas_List *l, *new_l;
 
    _evas_list_alloc_error = 0;
-   new_l = malloc(sizeof(Evas_List));
+   new_l = evas_mempool_malloc(&_evas_list_mempool, sizeof(Evas_List));
    if (!new_l)
      {
        _evas_list_alloc_error = 1;
@@ -63,11 +77,11 @@
    if (!list)
      {
        new_l->prev = NULL;
-       new_l->accounting = malloc(sizeof(Evas_List_Accounting));
+       new_l->accounting = evas_mempool_malloc(&_evas_list_accounting_mempool, 
sizeof(Evas_List_Accounting));
        if (!new_l->accounting)
          {
             _evas_list_alloc_error = 1;
-            free(new_l);
+            evas_mempool_free(&_evas_list_mempool, new_l);
             return list;
          }
        ((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
@@ -115,7 +129,7 @@
    Evas_List *new_l;
 
    _evas_list_alloc_error = 0;
-   new_l = malloc(sizeof(Evas_List));
+   new_l = evas_mempool_malloc(&_evas_list_mempool, sizeof(Evas_List));
    if (!new_l)
      {
        _evas_list_alloc_error = 1;
@@ -126,11 +140,11 @@
    if (!list)
      {
        new_l->next = NULL;
-       new_l->accounting = malloc(sizeof(Evas_List_Accounting));
+       new_l->accounting = evas_mempool_malloc(&_evas_list_accounting_mempool, 
sizeof(Evas_List_Accounting));
        if (!new_l->accounting)
          {
             _evas_list_alloc_error = 1;
-            free(new_l);
+            evas_mempool_free(&_evas_list_mempool, new_l);
             return list;
          }
        ((Evas_List_Accounting *)(new_l->accounting))->last = new_l;
@@ -193,7 +207,7 @@
          {
             Evas_List *new_l;
 
-            new_l = malloc(sizeof(Evas_List));
+            new_l = evas_mempool_malloc(&_evas_list_mempool, 
sizeof(Evas_List));
             if (!new_l)
               {
                  _evas_list_alloc_error = 1;
@@ -276,7 +290,7 @@
          {
             Evas_List *new_l;
 
-            new_l = malloc(sizeof(Evas_List));
+            new_l = evas_mempool_malloc(&_evas_list_mempool, 
sizeof(Evas_List));
              if (!new_l)
               {
                  _evas_list_alloc_error = 1;
@@ -375,8 +389,8 @@
      ((Evas_List_Accounting *)(list->accounting))->last = remove_list->prev;
    ((Evas_List_Accounting *)(list->accounting))->count--;
    if (((Evas_List_Accounting *)(list->accounting))->count == 0)
-     free(list->accounting);
-   free(remove_list);
+     evas_mempool_free(&_evas_list_accounting_mempool, list->accounting);
+   evas_mempool_free(&_evas_list_mempool, remove_list);
    return return_l;
 }
 
@@ -478,12 +492,12 @@
    Evas_List *l, *free_l;
 
    if (!list) return NULL;
-   free(list->accounting);
+   evas_mempool_free(&_evas_list_accounting_mempool, list->accounting);
    for (l = list; l;)
      {
        free_l = l;
        l = l->next;
-       free(free_l);
+       evas_mempool_free(&_evas_list_mempool, free_l);
      }
    return NULL;
 }
@@ -892,7 +906,7 @@
        ll->prev->next = NULL;
        ll->prev = NULL;
      }
-   ll->accounting = malloc(sizeof(Evas_List_Accounting));
+   ll->accounting = evas_mempool_malloc(&_evas_list_accounting_mempool, 
sizeof(Evas_List_Accounting));
    ((Evas_List_Accounting *)(ll->accounting))->last = llast;
    ((Evas_List_Accounting *)(ll->accounting))->count = size - mid;
 




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to