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)
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
148_edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed) 148_edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed)
149{ 149{
150 Eina_Inlist *l, *ln; 150 Eina_Inlist *l, *ln;
151 Eina_Inlist *tmpq = NULL;
152 Edje *lookup_ed; 151 Edje *lookup_ed;
153 Eina_List *groups = NULL, *lg; 152 Eina_List *groups = NULL, *lg;
154 Edje_Message *em; 153 Edje_Message *em;
@@ -167,39 +166,25 @@ _edje_object_message_signal_process_do(Eo *obj EINA_UNUSED, Edje *ed)
167 if (em->edje == lookup_ed) 166 if (em->edje == lookup_ed)
168 { 167 {
169 msgq = eina_inlist_remove(msgq, &(em->inlist_main)); 168 msgq = eina_inlist_remove(msgq, &(em->inlist_main));
170 tmpq = eina_inlist_append(tmpq, &(em->inlist_main)); 169 tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
170 em->in_tmp_msgq = EINA_TRUE;
171 break; 171 break;
172 } 172 }
173 } 173 }
174 } 174 }
175 /* a temporary message queue */
176 if (tmp_msgq)
177 {
178 while (tmpq)
179 {
180 l = tmpq;
181 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
182 tmpq = eina_inlist_remove(tmpq, &(em->inlist_main));
183 tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
184 }
185 }
186 else
187 {
188 tmp_msgq = tmpq;
189 tmpq = NULL;
190 }
191 175
192 tmp_msgq_processing++; 176 tmp_msgq_processing++;
193again: 177again:
194 for (l = tmp_msgq; l; l = ln) 178 for (l = ed->messages; l; l = ln)
195 { 179 {
196 ln = l->next; 180 ln = l->next;
197 em = INLIST_CONTAINER(Edje_Message, l, inlist_main); 181 em = INLIST_CONTAINER(Edje_Message, l, inlist_edje);
182 if (!em->in_tmp_msgq) continue;
183 // so why this? any group edje is not the parent - skip this
198 EINA_LIST_FOREACH(groups, lg, lookup_ed) 184 EINA_LIST_FOREACH(groups, lg, lookup_ed)
199 { 185 {
200 if (em->edje == lookup_ed) break; 186 if (em->edje == lookup_ed) break;
201 } 187 }
202 if (em->edje != lookup_ed) continue;
203 tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main)); 188 tmp_msgq = eina_inlist_remove(tmp_msgq, &(em->inlist_main));
204 em->edje->messages = eina_inlist_remove(em->edje->messages, &(em->inlist_edje)); 189 em->edje->messages = eina_inlist_remove(em->edje->messages, &(em->inlist_edje));
205 if (!lookup_ed->delete_me) 190 if (!lookup_ed->delete_me)
@@ -874,21 +859,14 @@ _edje_message_queue_process(void)
874 for (i = 0; (i < 8) && (msgq); i++) 859 for (i = 0; (i < 8) && (msgq); i++)
875 { 860 {
876 /* a temporary message queue */ 861 /* a temporary message queue */
877 if (tmp_msgq) 862 while (msgq)
878 { 863 {
879 while (msgq) 864 Eina_Inlist *l = msgq;
880 {
881 Eina_Inlist *l = msgq;
882 865
883 em = INLIST_CONTAINER(Edje_Message, l, inlist_main); 866 em = INLIST_CONTAINER(Edje_Message, l, inlist_main);
884 msgq = eina_inlist_remove(msgq, &(em->inlist_main)); 867 msgq = eina_inlist_remove(msgq, &(em->inlist_main));
885 tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main)); 868 tmp_msgq = eina_inlist_append(tmp_msgq, &(em->inlist_main));
886 } 869 em->in_tmp_msgq = EINA_TRUE;
887 }
888 else
889 {
890 tmp_msgq = msgq;
891 msgq = NULL;
892 } 870 }
893 871
894 tmp_msgq_processing++; 872 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
2226 Edje *edje; 2226 Edje *edje;
2227 unsigned char *msg; 2227 unsigned char *msg;
2228 int id; 2228 int id;
2229 Eina_Bool propagated : 1; 2229 Eina_Bool in_tmp_msgq : 1;
2230 Edje_Queue queue : 2; 2230 Eina_Bool propagated : 1;
2231 Edje_Message_Type type : 29; 2231 Edje_Queue queue : 2;
2232 Edje_Message_Type type : 28;
2232}; 2233};
2233 2234
2234typedef enum _Edje_Fill 2235typedef enum _Edje_Fill