gcc: memcpy on armv7 is much slower than on armhf
I recently switched from armhf to armv7 and noticed that memcpy on armv7 is much slower than on armhf.
Here is a simple test:
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define N 131072
int main()
{
int i;
clock_t time[2];
void *src = malloc(N);
void *dst = malloc(N);
time[0] = clock();
for(i = 0; i < N; ++i)
{
memcpy(dst, src, N);
}
time[1] = clock();
printf("time: %ld\n", time[1] - time[0]);
return 0;
}
and the results:
armhf:~# time ./test
time: 7310658
real 0m 7.31s
user 0m 7.31s
sys 0m 0.00s
armv7:~# time ./test
time: 12973756
real 0m 12.97s
user 0m 12.97s
sys 0m 0.00s
I suspect the source of the problem is the --with-mode=thumb
flag on line 235 in gcc/APKBUILD.
Would it be possible to replace --with-mode=thumb
with --with-mode=arm
?
Edited by Pavel Demin