evas_common: use memcpy to copy pixel buffer

Summary: This function has no special processing when copy data, so using memcpy can enhance performance

Test Plan:
```
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>

typedef unsigned int       DATA32;

static void
oldFunc(DATA32 *src, DATA32 *dst, size_t len)
{
   DATA32 *dst_end = dst + len;
   while (dst < dst_end)
      *dst++ = *src++;
}

static void
newFunc(DATA32 *src, DATA32 *dst, size_t len)
{
   memcpy(dst, src, len * sizeof(DATA32));
}

int main()
{

   int counter = 1000;
   srand(time(NULL));
   DATA32 src[50000] = {0};
   DATA32 dst[50000] = {0};

   for (int i = 0; i < 50000; i++)
      src[i] = rand();

   clock_t start, end;
   double total_Time1 = 0;
   int i;

   start = clock();
   for (i = 0; i < counter; i++)
      oldFunc(src, dst, 50000);
   end = clock();
   total_Time1 = ((double)(end - start)) / CLOCKS_PER_SEC;
   printf("original = %f \n", total_Time1);

   start = clock();
   for (i = 0; i < counter; i++)
      newFunc(src, dst, 50000);
   end = clock();
   total_Time1 = ((double)(end - start)) / CLOCKS_PER_SEC;
   printf("modified = %f \n", total_Time1);
}
```

Reviewers: raster, ManMower, woohyun, Hermet

Reviewed By: Hermet

Subscribers: Hermet, vtorri, cedric, #reviewers, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D9155
This commit is contained in:
Ali Alzyod 2019-06-25 21:48:40 +09:00 committed by Hermet Park
parent 907bdad065
commit c25554c4f2
1 changed files with 1 additions and 3 deletions

View File

@ -242,9 +242,7 @@ evas_common_copy_pixels_rev_c(src, dst, len);
static void
evas_common_copy_pixels_c(DATA32 *src, DATA32 *dst, int len)
{
DATA32 *dst_end = dst + len;
while (dst < dst_end) *dst++ = *src++;
memcpy(dst, src, len * sizeof(DATA32));
}
#ifdef BUILD_MMX