summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <chuneon.park@samsung.com>2020-04-28 14:35:26 +0900
committerHermet Park <chuneon.park@samsung.com>2020-04-28 14:50:13 +0900
commit88dd66f3d15b6839a7e64a672c73e9d4a352c9aa (patch)
tree83304fb61ee899e6bf3b846a5aca682213a8d126
parent0de64f2d91ffa4bcf106b0b0bef2fb5f8783e122 (diff)
canvas clip: replace hash to cached array.
Each child_map_across_mark() takes 0.026ms with eina_hash we can reduce the performing time by replacing the hash to array to 0.0041ms in a device. Before Average: 0.026ms Mostly it takes 23 times in the scrolling. thus it takes 3%(0.48ms) in one frame rendering (16ms) After Average: 0.0041ms Mostly it takes 23 times in the scrolling. thus it takes 0.6%(0.096ms) in one frame rendering (16ms) result: map calc 5x faster than original (0.384ms improved) Thanks Subhransu for report this. @optimization
-rw-r--r--src/lib/evas/canvas/evas_clip.c27
-rw-r--r--src/lib/evas/canvas/evas_main.c3
-rw-r--r--src/lib/evas/canvas/evas_render.c3
-rw-r--r--src/lib/evas/include/evas_private.h1
4 files changed, 21 insertions, 13 deletions
diff --git a/src/lib/evas/canvas/evas_clip.c b/src/lib/evas/canvas/evas_clip.c
index 210aa5fc7d..55ecdb2179 100644
--- a/src/lib/evas/canvas/evas_clip.c
+++ b/src/lib/evas/canvas/evas_clip.c
@@ -74,30 +74,30 @@ evas_object_recalc_clippees(Evas_Object_Protected_Data *obj)
74 74
75#define MAP_ACROSS 1 75#define MAP_ACROSS 1
76static void 76static void
77evas_object_child_map_across_mark(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *map_obj, Eina_Bool force, Eina_Hash *visited) 77evas_object_child_map_across_mark(Evas_Object *eo_obj, Evas_Object_Protected_Data *obj, Evas_Object *map_obj, Eina_Bool force, Eina_Array* visited)
78{ 78{
79#ifdef MAP_ACROSS 79#ifdef MAP_ACROSS
80 Eina_Bool clear_visited = EINA_FALSE; 80 Eina_Bool clear_visited = EINA_FALSE;
81
82 if (!visited) 81 if (!visited)
83 { 82 {
84 visited = eina_hash_pointer_new(NULL); 83 visited = &obj->layer->evas->map_clip_objects;
85 clear_visited = EINA_TRUE; 84 clear_visited = EINA_TRUE;
86 } 85 }
87 if (eina_hash_find(visited, &eo_obj) == (void *)1) goto end; 86
88 else eina_hash_add(visited, &eo_obj, (void *)1); 87 if (eina_array_find(visited, (void*) eo_obj, NULL)) goto end;
89 88 else eina_array_push(visited, (void*) eo_obj);
89
90 if ((obj->map->cur.map_parent != map_obj) || force) 90 if ((obj->map->cur.map_parent != map_obj) || force)
91 { 91 {
92 EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write) 92 EINA_COW_WRITE_BEGIN(evas_object_map_cow, obj->map, Evas_Object_Map_Data, map_write)
93 map_write->cur.map_parent = map_obj; 93 map_write->cur.map_parent = map_obj;
94 EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write); 94 EINA_COW_WRITE_END(evas_object_map_cow, obj->map, map_write);
95 95
96 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur) 96 EINA_COW_STATE_WRITE_BEGIN(obj, state_write, cur)
97 { 97 {
98 state_write->cache.clip.dirty = 1; 98 state_write->cache.clip.dirty = 1;
99 } 99 }
100 EINA_COW_STATE_WRITE_END(obj, state_write, cur); 100 EINA_COW_STATE_WRITE_END(obj, state_write, cur);
101 101
102 evas_object_clip_recalc(obj); 102 evas_object_clip_recalc(obj);
103 if (obj->is_smart) 103 if (obj->is_smart)
@@ -125,8 +125,9 @@ evas_object_child_map_across_mark(Evas_Object *eo_obj, Evas_Object_Protected_Dat
125 } 125 }
126 } 126 }
127 } 127 }
128end: 128
129 if (clear_visited) eina_hash_free(visited); 129end:
130 if (clear_visited) eina_array_clean(visited);
130#endif 131#endif
131} 132}
132 133
diff --git a/src/lib/evas/canvas/evas_main.c b/src/lib/evas/canvas/evas_main.c
index fc53f64dc8..956e13dbcf 100644
--- a/src/lib/evas/canvas/evas_main.c
+++ b/src/lib/evas/canvas/evas_main.c
@@ -363,6 +363,8 @@ _evas_canvas_efl_object_constructor(Eo *eo_obj, Evas_Public_Data *e)
363 EVAS_ARRAY_SET(e, glyph_unref_queue); 363 EVAS_ARRAY_SET(e, glyph_unref_queue);
364 EVAS_ARRAY_SET(e, texts_unref_queue); 364 EVAS_ARRAY_SET(e, texts_unref_queue);
365 365
366 eina_array_step_set(&e->map_clip_objects, sizeof(e->map_clip_objects), 64);
367
366 e->active_objects.version = EINA_ARRAY_VERSION; 368 e->active_objects.version = EINA_ARRAY_VERSION;
367 eina_inarray_step_set(&e->active_objects, 369 eina_inarray_step_set(&e->active_objects,
368 sizeof(Eina_Inarray), 370 sizeof(Eina_Inarray),
@@ -644,6 +646,7 @@ _evas_canvas_efl_object_destructor(Eo *eo_e, Evas_Public_Data *e)
644 eina_array_flush(&e->image_unref_queue); 646 eina_array_flush(&e->image_unref_queue);
645 eina_array_flush(&e->glyph_unref_queue); 647 eina_array_flush(&e->glyph_unref_queue);
646 eina_array_flush(&e->texts_unref_queue); 648 eina_array_flush(&e->texts_unref_queue);
649 eina_array_flush(&e->map_clip_objects);
647 eina_hash_free(e->focused_objects); 650 eina_hash_free(e->focused_objects);
648 651
649 SLKL(e->post_render.lock); 652 SLKL(e->post_render.lock);
diff --git a/src/lib/evas/canvas/evas_render.c b/src/lib/evas/canvas/evas_render.c
index 4a44c5e6ea..1d47ba06af 100644
--- a/src/lib/evas/canvas/evas_render.c
+++ b/src/lib/evas/canvas/evas_render.c
@@ -4127,6 +4127,7 @@ _evas_canvas_render_idle_flush(Eo *eo_e, Evas_Public_Data *evas)
4127 OBJS_ARRAY_FLUSH(&evas->delete_objects); 4127 OBJS_ARRAY_FLUSH(&evas->delete_objects);
4128 OBJS_ARRAY_FLUSH(&evas->obscuring_objects); 4128 OBJS_ARRAY_FLUSH(&evas->obscuring_objects);
4129 OBJS_ARRAY_FLUSH(&evas->temporary_objects); 4129 OBJS_ARRAY_FLUSH(&evas->temporary_objects);
4130 OBJS_ARRAY_FLUSH(&evas->map_clip_objects);
4130 eina_array_foreach(&evas->clip_changes, _evas_clip_changes_free, NULL); 4131 eina_array_foreach(&evas->clip_changes, _evas_clip_changes_free, NULL);
4131 eina_array_clean(&evas->clip_changes); 4132 eina_array_clean(&evas->clip_changes);
4132 4133
@@ -4243,6 +4244,7 @@ if (Cow) while (eina_cow_gc(Cow))
4243 OBJS_ARRAY_FLUSH(&evas->delete_objects); 4244 OBJS_ARRAY_FLUSH(&evas->delete_objects);
4244 OBJS_ARRAY_FLUSH(&evas->obscuring_objects); 4245 OBJS_ARRAY_FLUSH(&evas->obscuring_objects);
4245 OBJS_ARRAY_FLUSH(&evas->temporary_objects); 4246 OBJS_ARRAY_FLUSH(&evas->temporary_objects);
4247 OBJS_ARRAY_FLUSH(&evas->map_clip_objects);
4246 eina_array_foreach(&evas->clip_changes, _evas_clip_changes_free, NULL); 4248 eina_array_foreach(&evas->clip_changes, _evas_clip_changes_free, NULL);
4247 eina_array_clean(&evas->clip_changes); 4249 eina_array_clean(&evas->clip_changes);
4248 4250
@@ -4268,6 +4270,7 @@ evas_render_invalidate(Evas *eo_e)
4268 OBJS_ARRAY_FLUSH(&e->delete_objects); 4270 OBJS_ARRAY_FLUSH(&e->delete_objects);
4269 4271
4270 OBJS_ARRAY_FLUSH(&e->snapshot_objects); 4272 OBJS_ARRAY_FLUSH(&e->snapshot_objects);
4273 OBJS_ARRAY_FLUSH(&e->map_clip_objects);
4271 4274
4272 e->invalidate = EINA_TRUE; 4275 e->invalidate = EINA_TRUE;
4273} 4276}
diff --git a/src/lib/evas/include/evas_private.h b/src/lib/evas/include/evas_private.h
index 036ef71ca9..3a24821dd2 100644
--- a/src/lib/evas/include/evas_private.h
+++ b/src/lib/evas/include/evas_private.h
@@ -453,6 +453,7 @@ struct _Evas_Public_Data
453 Eina_Array image_unref_queue; 453 Eina_Array image_unref_queue;
454 Eina_Array glyph_unref_queue; 454 Eina_Array glyph_unref_queue;
455 Eina_Array texts_unref_queue; 455 Eina_Array texts_unref_queue;
456 Eina_Array map_clip_objects;
456 Eina_List *finalize_objects; 457 Eina_List *finalize_objects;
457 458
458 struct { 459 struct {