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 > memcpy() versus ldmia/stmia versus dmaCopyWords() versus...

#177254 - sverx - Fri Feb 24, 2012 3:13 pm

I was always asking myself... well, then I made a small program that measures the time taken to copy 64000 bytes from main memory to main or to video memory, using memcopy(), using ldmia/stmia on 8 registers, reading from uncached and/or cache unaligned locations, unrolling ldmia/stmia loops, using ldmia/stmia on 10 registers, using a DTCM temporary storage area, or using dmaCopyWords().

All the results are here, the program too.

Somebody eventually may find it useful/interesting :)

#177298 - LOst? - Sun Apr 01, 2012 5:51 am

What is the fastest method of updating the OAM?
(I don't want to guess the memory locations, but I mean copying a full global array of OAM entries to OAM RAM each picture frame).

#177299 - sverx - Sun Apr 01, 2012 2:45 pm

Each OAM is just 1 KB, so it doesn't make a big difference.

I would bet either on dmaCopyWords(), keeping in mind you need to flush the cache so that your copy in main memory has been written before starting the DMA copy OR you can make your own simple ldmia/stmia asm routine and don't ever worry about the whole caching thing...