cedric pushed a commit to branch master.

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

commit 8a39069b64507650c6746f5e93b4aa86934f588a
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Tue Oct 13 12:10:34 2015 -0700

    evas: fix performance regression by reducing the unecessary memcpy we are 
doing.
    
    Actually copying max is pretty useless and super slow. We usually have 
something
    like 1024 slot in a context, but a very small amount of them are acutally 
active.
    It would be better to actually do some kind of copy on write technique 
here, but
    as Eina_Cow doesn't handle array and we are close to a release, let's be
    conservative.
---
 src/lib/evas/common/evas_draw_main.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/lib/evas/common/evas_draw_main.c 
b/src/lib/evas/common/evas_draw_main.c
index b444608..460a296 100644
--- a/src/lib/evas/common/evas_draw_main.c
+++ b/src/lib/evas/common/evas_draw_main.c
@@ -16,11 +16,12 @@ evas_common_draw_context_cutouts_dup(Cutout_Rects *rects2, 
const Cutout_Rects *r
 {
    if (!rects) return;
    rects2->active = rects->active;
-   rects2->max = rects->max;
+   rects2->max = rects->active;
    rects2->last_add = rects->last_add;
-   if (rects->max > 0)
+   rects2->rects = NULL;
+   if (rects2->max > 0)
      {
-        const size_t sz = sizeof(Cutout_Rect) * rects->max;
+        const size_t sz = sizeof(Cutout_Rect) * rects2->max;
         rects2->rects = malloc(sz);
         memcpy(rects2->rects, rects->rects, sz);
      }

-- 


Reply via email to