There are a lot of accusations about MAME being slow, about how it is a documentation project, not an exercise in performance tuning. Most people seem to think that a 20 year old version of MAME is the best you can hope for out of a Raspberry Pi. I’m here to say that’s not the case. If you set your expectations at a reasonable level, you tweak your settings in a sensible way, and you overclock wherever you can, you will probably be pleasantly surprised.
I’ve run benchmarks on a set of 150 games in MAME. I tried to pick a fair sampling of the classics and the more modern games, I even included a couple of obviously impossible ones. I do seem to have ended up with far too many CPS2 games though!
The benchmarks have been run on the Raspberry Pi Model B, The Raspberry Pi 2 and the Raspberry Pi 3. I ran them Overclocked. I used the same SD card, with the same system set-up and same software installed. Just popping it out and putting into the next Pi in turn.
I ran an extra set of Benchmarks on the Pi3 using the switches -str 90 -nothrottle
to get a set of real world speed figures.
Here is the final Benchmark table:-
MAME Benchmarks
[table id=3 datatables_fixedheader=top /]Getting the most out of the Raspberry Pi
I made some small changes to /boot/config.txt
and to mame.ini
to try and get the most out of the hardware.
Obviously set up MAME’s mame.ini
so that your roms/samples etc. are all located correctly; then these are the settings I changed from the default.
# # CORE ARTWORK OPTIONS # artwork_crop 0 use_backdrops 0 use_overlays 0 use_bezels 0 use_cpanels 0 use_marquees 0 # # CORE SOUND OPTIONS # samplerate 22000 # # OSD ACCELERATED VIDEO OPTIONS # filter 0
This just turns off artwork, lowers the sound sample rate and makes sure we aren’t applying any filters.
Then I edited the /boot/config.txt
file and made these changes.
hdmi_group=2 hdmi_mode=4
This just sets the screen resolution to 640×480. The smaller the screen resolution, the less the GPU has to update, the faster it all goes.
I also built SDL2-2.0.4 from source to get GPU hardware support, at the moment Raspbian comes with 2.0.2 which only uses software. See my tutorial on compiling MAME for details on doing that.
None of this helps at all with the benchmarks but does help when you try to run the games for real.
These are the overclock settings I used. The Pi’s were all fitted with heatsinks; the Pi3 is also in an open case with built in fan. I used a high quality 2.5A power supply for all the tests.
[table id=2 /]To run the benchmarks I wrote a little shell script, It looks like this
#!/bin/bash BR='\033[0;33m' NC='\033[0m' # No Color while read -r romlist || [[ -n "$romlist" ]]; do declare -a array=( $romlist ) rom="${array[0]}" echo -e "${BR}Starting: $rom ${NC} at $(date)" ./mame -listfull $rom >> "$2" ./mame -str 90 -nothrottle $rom >> "$2" ./mame -bench 90 $rom >> "$2" done < "$1"
This will open a text file passed from the command line and use the first word of each line as the name of a game to run benchmarks on. Then I wrote a list of games and saved it to a file and ran the benchmarks using the command bash bench.sh romlist.txt pi3oc.txt
. Then it was just some text editing and a little massaging in a spreadsheet to get a single table from the five output files.