Memory access

"Erazem Polutnik" <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <C2BCD0601AC143E08A8391A360311017@Frodo>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.