Fastmem-arm


Hitnrun

Member
Joined
Mar 1, 2008
Messages
427
I found this while looking for allegro information:


http://osdir.com/ml/handhelds.maemo.devel/...3/msg00168.html

It's basically memset and memcpy ARM-assembler optimized. Anyone tried it, does it make any difference?

I run it on my gp2x, I got this:

CODE

--- running correctness tests ---
all the correctness tests passed
--- running performance tests (memory bandwidth benchmark) ---:
memset() memory bandwidth: 223.10MB/s
memset8() memory bandwidth: 262.14MB/s
memcpy() memory bandwidth (perfectly aligned): 49.00MB/s
memcpy16() memory bandwidth (perfectly aligned): 51.15MB/s
memcpy() memory bandwidth (16-bit aligned): 40.25MB/s
memcpy16() memory bandwidth (16-bit aligned): 46.60MB/s
--- testing performance for random blocks (size 0-15 bytes) ---
memset time: 0.600
memset8 time: 0.610
--- testing performance for random blocks (size 0-511 bytes) ---
memset time: 1.740
memset8 time: 1.550



Can it give any additional performance?
 
There are versions of memset, memcpy memcmp (and others) written for the ARM cpu which are used in a number of projects including MAME4ALL, CPS2EMU, etc. They give good speed increases. Have a look at the MAME4ALL source code for example.
 
slaanesh said:
There are versions of memset, memcpy memcmp (and others) written for the ARM cpu which are used in a number of projects including MAME4ALL, CPS2EMU, etc. They give good speed increases. Have a look at the MAME4ALL source code for example.
Hmm how do I use them, I see there is a memset.S that defines a memset function, but I don't see a .h with the function definition, just by linking this file the default memset is replaced by this one?
 
Last edited by a moderator:
Hitnrun said:
Hmm how do I use them, I see there is a memset.S that defines a memset function, but I don't see a .h with the function definition, just by linking this file the default memset is replaced by this one?
Yes, that's right.

ie. Here is a MAP file from a gcc compile of a GP32 project.
This project build uses memset from the memset.S:

CODE
.text 0x0c0b8c10 0xa0 obj/gp32/memset.o
0x0c0b8c10 memset


You can define the functions as well if you wish in a *.h to avoid get warnings like this:

CODE
src/gzio.c:362: warning: implicit declaration of function 'memset'



They are excellent functions and if the code has heavy use of memset, memcpy then you will notice a speed difference.
 
Last edited by a moderator:
Thanks for the heads-up on this little gem. If it's really as simple as just linking against another file, I've got to give it a try for my projects too.

Especially if that one simple fix makes a ~17% improvement in speed, even if it's only the speed of the memset/cpy/cmp.
 
slaanesh said:
Hitnrun said:
Hmm how do I use them, I see there is a memset.S that defines a memset function, but I don't see a .h with the function definition, just by linking this file the default memset is replaced by this one?
Yes, that's right.

ie. Here is a MAP file from a gcc compile of a GP32 project.
This project build uses memset from the memset.S:

CODE
.text 0x0c0b8c10 0xa0 obj/gp32/memset.o
0x0c0b8c10 memset


You can define the functions as well if you wish in a *.h to avoid get warnings like this:

CODE
src/gzio.c:362: warning: implicit declaration of function 'memset'



They are excellent functions and if the code has heavy use of memset, memcpy then you will notice a speed difference.


Hmm didn't game too much difference to me, it went from 24-25 fps to 25-26. And allegro makes heavy use of memcpy (all blits use a memcpy-per-scanline for all bitmaps, and there are lots).

How can I see if the memset is really in the binary, like you did on the .text section? I tried arm-open2x-linux-objdump, but didn't find an option to display this...
 
Last edited by a moderator:
Back
Top