Memory access

Ni@m niam.niam at gmail.com
Thu Feb 4 05:40:46 EST 2010


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 <erazem at lxnav.com> 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
> linux-arm at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm/attachments/20100204/08271d36/attachment.htm>


More information about the linux-arm mailing list