Memory access
Erazem Polutnik
erazem at lxnav.com
Thu Feb 4 05:08:57 EST 2010
Hello,
I create a small test program, which is intend to rotate a memory map for 90
degrees.
void Test()
{
#define DX 480
#define DY 640
WORD *dst,*src;
src = new WORD[DX*DY];
dst = new WORD[DX*DY];
int pxm=DX;
int pym=DY;
for(int i=0;i<100;i++) {
for(int py=0;py<pym;py++) {
WORD *p1=dst+(py*DX);
WORD const *p2=src+(pym-py-1);
for(int px=0; px<pxm; px++) {
if(px<DY && py<DX) {
*p1=*p2;
}
p1++;
p2+=DY;
}
}
}
delete [] dst;
delete [] src;
}
The problem this is running very slow on Toradex Colibri PXA270 linux
version 2.6.27.
It takes 18seconds to finish it.
If I just replace line *p1=*p2 with *p1=0xff, it takes 490ms.
So my assumpation is that reading of "random" memory is very slow.
I there a way to speed-up such "random" reading?
Many thanks
Erazem
More information about the linux-arm
mailing list