gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > RAM access speed

#117926 - Risine - Thu Feb 08, 2007 7:15 pm

I've got some real strange behaviour with RAM speed access.
I'm creating a whole image in an allocated short array ( dst=new... ).
and have something like :
fnt toto
{
...
for (each pixel) {
...
dst[y]=colour;
}
...
}
It takes really a very long time ( x2 ), compared to this :
fnt toto
{
short temp[4]; // local test array
...
for (each pixel) {
...
temp[y&3]=colour;
}
...
}

How can it be possible?
It takes more time writing this pixel in RAM, than reading it from ROM and treating it.

#117981 - Mighty Max - Thu Feb 08, 2007 11:51 pm

The stack is in ITCM which can be accessed faster the wram or vram.

If you'd put the small array into wram, the second example would have still an advantage, as the cache would cover up the wram/vram slowness.
_________________
GBAMP Multiboot

#117997 - Risine - Fri Feb 09, 2007 12:55 am

Well, I'm still estonished of the slowness of the RAM writing.
The operation here:
...
dst[y]=colour;
...

takes many more time than reading the pixel from ROM and doing many things on it.
...

#118149 - Risine - Sat Feb 10, 2007 2:14 pm

My DS exec. runs on a GBA EZ-Cart.
I'm wondering, is it possible that the exec. runs at the speed of the gba ( for emulations purposes )?
Because 48 cycles for a simple RAM writing is pretty huge, isn't it?

If this is the case, is there a way to make it work at the DS speed?

#118345 - kusma - Mon Feb 12, 2007 10:55 am

Actually, I think the biggest speed difference here is due to the 2-word array going immediately into cache.