forked from enlightenment/efl
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.
This commit is contained in:
parent
4aed68ee3f
commit
c922cdc145
|
@ -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++;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue