Re: Memory access

"Ni@m" <[email protected]>
Newsgroups gmane.linux.ports.arm.general
Message-ID <[email protected]>
Hi!

PXA270 has 32Kb of cache.
Each of your arrays is 300Kb long, so you have a lot of cache misses.
You should optimize your algorithm.

Best regards!

-- Dima

On Thu, Feb 4, 2010 at 12:08 PM, Erazem Polutnik <[email protected]> wrote:

> 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
>
>
> _______________________________________________
> linux-arm mailing list
> [email protected]
> http://lists.infradead.org/mailman/listinfo/linux-arm
>

_______________________________________________
linux-arm mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm
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.