summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-06-14 23:55:53 +0100
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-06-15 08:43:44 +0100
commit613e1715be1114c2221f1a12f067e3d1e215265f (patch)
tree4cf2784b479d0367866b16a58f5c3cbe3d79aef2
parentbda708d38fbea33fc2554d95e661af6e36b79f5b (diff)
downloadefl-613e1715be1114c2221f1a12f067e3d1e215265f.tar.gz
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.
-rw-r--r--src/lib/edje/edje_message_queue.c46
-rw-r--r--src/lib/edje/edje_private.h7
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 1593d8177f..69e36776eb 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -2226,9 +2226,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