raster pushed a commit to branch efl-1.22.

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

commit c922cdc1459c323d9904fbcf1cedf90aebc70019
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Fri Jun 14 23:55:53 2019 +0100

    edje messages - avoid nasty On2 walk of message lists with skipping
    
    so to process a single obj we added a lot of mesgs to the message
    queueue only then to wak most and SKIP most msgs again and again -
    when this adds up to 1000's of messages and 10k+ then literally moving
    a window in e hangs for multiple seconds and we walk such lists in On2
    like complexity. this gets it down to O(1) along with some other minor
    optimizations of not adding to tmp list only then to add them to the
    nex queue/list.
    
    there is more i can optimize here as well now we track messages for an
    edje in th edje. that's next.
---
 src/lib/edje/edje_message_queue.c | 46 ++++++++++-----------------------------
 src/lib/edje/edje_private.h       |  7 +++---
 2 files changed, 16 insertions(+), 37 deletions(-)

diff --git a/src/lib/edje/edje_message_queue.c 
b/src/lib/edje/edje_message_queue.c
index e92cbabfc5..0257127969 100644
--- a/src/lib/edje/edje_message_queue.c
+++ b/src/lib/edje/edje_message_queue.c
@@ -148,7 +148,6 @@ static void
 _edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed)
 {
    Eina_Inlist *l, *ln;
-   Eina_Inlist *tmpq = NULL;
    Edje *lookup_ed;
    Eina_List *groups = NULL, *lg;
    Edje_Message *em;
@@ -167,39 +166,25 @@ _edje_object_message_signal_process_do(Eo *obj 
EINA_UNUSED, Edje *ed)
              if (em->edje == lookup_ed)
                {
                   msgq = eina_inlist_remove(msgq, &(em->inlist_main));
-                  tmpq = eina_inlist_append(tmpq, &(em->inlist_main));
+                  tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
+                  em->in_tmp_msgq = EINA_TRUE;
                   break;
                }
           }
      }
-   /* a temporary message queue */
-   if (tmp_msgq)
-     {
-        while (tmpq)
-          {
-             l = tmpq;
-             em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
-             tmpq = eina_inlist_remove(tmpq, &(em->inlist_main));
-             tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
-          }
-     }
-   else
-     {
-        tmp_msgq = tmpq;
-        tmpq = NULL;
-     }
 
    tmp_msgq_processing++;
 again:
-   for (l = tmp_msgq; l; l = ln)
+   for (l = ed->messages; l; l = ln)
      {
         ln = l->next;
-        em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
+        em = INLIST_CONTAINER(Edje_Message, l, inlist_edje);
+        if (!em->in_tmp_msgq) continue;
+        // so why this? any group edje is not the parent - skip this
         EINA_LIST_FOREACH(groups, lg, lookup_ed)
           {
              if (em->edje == lookup_ed) break;
           }
-        if (em->edje != lookup_ed) continue;
         tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main));
         em->edje->messages = eina_inlist_remove(em->edje->messages, 
&(em->inlist_edje));
         if (!lookup_ed->delete_me)
@@ -874,21 +859,14 @@ _edje_message_queue_process(void)
    for (i = 0; (i < 8) && (msgq); i++)
      {
         /* a temporary message queue */
-        if (tmp_msgq)
+        while (msgq)
           {
-             while (msgq)
-               {
-                  Eina_Inlist *l = msgq;
+             Eina_Inlist *l = msgq;
 
-                  em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
-                  msgq = eina_inlist_remove(msgq, &(em->inlist_main));
-                  tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
-               }
-          }
-        else
-          {
-             tmp_msgq = msgq;
-             msgq = NULL;
+             em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
+             msgq = eina_inlist_remove(msgq, &(em->inlist_main));
+             tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
+             em->in_tmp_msgq = EINA_TRUE;
           }
 
         tmp_msgq_processing++;
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index 3914cbb613..0695f136a1 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2231,9 +2231,10 @@ struct _Edje_Message
    Edje              *edje;
    unsigned char     *msg;
    int                id;
-   Eina_Bool          propagated : 1;
-   Edje_Queue         queue      : 2;
-   Edje_Message_Type  type       : 29;
+   Eina_Bool          in_tmp_msgq :  1;
+   Eina_Bool          propagated  :  1;
+   Edje_Queue         queue       :  2;
+   Edje_Message_Type  type        : 28;
 };
 
 typedef enum _Edje_Fill

-- 


Reply via email to