summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorali <ali198724@gmail.com>2019-06-25 21:48:40 +0900
committerHermet Park <hermetpark@gmail.com>2019-06-25 21:48:42 +0900
commitc25554c4f23248640aaa257f28313f39b57a69c5 (patch)
treea7018d1d81e0fb72ddb5b7998cef69a36afbbe9e
parent907bdad065aac9676613ed49e5aedfd7f9052b27 (diff)
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
-rw-r--r--src/lib/evas/common/evas_blit_main.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lib/evas/common/evas_blit_main.c b/src/lib/evas/common/evas_blit_main.c
index efecade36e..afeea86f8b 100644
--- a/src/lib/evas/common/evas_blit_main.c
+++ b/src/lib/evas/common/evas_blit_main.c
@@ -242,9 +242,7 @@ evas_common_copy_pixels_rev_c(src, dst, len);
242static void 242static void
243evas_common_copy_pixels_c(DATA32 *src, DATA32 *dst, int len) 243evas_common_copy_pixels_c(DATA32 *src, DATA32 *dst, int len)
244{ 244{
245 DATA32 *dst_end = dst + len; 245 memcpy(dst, src, len * sizeof(DATA32));
246
247 while (dst < dst_end) *dst++ = *src++;
248} 246}
249 247
250#ifdef BUILD_MMX 248#ifdef BUILD_MMX