FAQ:Performance: Difference between revisions

From MAMEDEV Wiki
No edit summary
(No longer needed.)
Line 1: Line 1:
Return to the main [[Frequently Asked Questions]] page.
==Why do some games run so slowly on my system?==
There are many things that are difficult to emulate without expending a large amount of CPU power. Some specific examples are:


* Emulating analog (discrete) audio circuits accurately requires higher math functions executed repeatedly, millions of times per second. Many older games which would otherwise be a walk in the park to emulate quickly can be bogged down with simulation of the analog audio. Reducing the sound output rate can help improve performance for these games.
* Games with multiple CPUs that share memory often have very tight timing requirements. In order to prevent the two CPUs from getting out of sync, MAME must essentially execute one instruction at a time on each CPU in turn. Even if the CPUs don't get out of sync, running the two CPUs in lockstep like this improves the overall emulation accuracy.
* Games with 3D graphics. As of this writing, MAME does not pass polygons down to the video card of your system; instead, it renders all 3D graphics by hand in software. Although this code is generally optimized to take advantage of multiple CPUs, it is still quite taxing to do this. Some 3D games give you control of the output resolution; reducing it will reduce the CPU requirements.
One thing that is counterintuitive is that it is generally the older games that require analog audio simulation or very tight CPU synchronization. This means that even something as innocuous as Donkey Kong might require a pretty beefy system to run at full speed.
It is important to keep in mind that MAME's primary goal is to accurately reproduce the game hardware. In some cases, it may not be possible to do this on any system that exists today.
==How can I get games to run faster?==
This is the most commonly-asked question in the emulation world. In general, there is not really that much you can do to significantly speed up a game. However, here are some things you can try to improve MAME's performance:
* Use a faster CPU. This is the most reliable speed-increaser.
* Upgrade your graphics card, or update your present card's drivers. Swapping your generic (cheap) card for a high-quality (not cheap) card will certainly boost performance. If you are using on-board (integrated) video, you'll see a great performance increase by simply getting a new graphics card. Check your graphics card drivers, too. Newer drivers — especially for cheaper cards — can make all the difference.
* Get the latest MAME version. Or try an older/different one. MAME is in constant development. Due to transitional changes in the core code, some games run better/faster with different versions. Try and see for yourself which works best.
MAME itself also has many options that can increase your speed:
* Lower the sound quality. Try adding -sr 11025 to the command line, which will decrease sound playback quality and use less processor time. This mostly affects games that use discrete audio.
* Disable the joystick and use the keyboard (-nojoy).
* Use frameskip to speed up animation. Frameskip skips a certain number of frames per second, so your system does less work. Sometimes the trade-off is choppy animation; sometimes the difference is negligible. Experiment. While playing, press '''F8''' / '''F9''' to control frameskip; or set global frameskip in mame.ini. Some games don't benefit from frameskip though, for example the newer Williams bitmap graphics games or the Atari filled polygon games.
==There are occasional speed problems.==
This can be caused by several factors.  If you press F11 when playing, you can see the FPS meter.  if it is normally running at full speed, but ocassionally gets slow, you might check the following:
# See if there are any background processes running.  Sometimes other applications open at the same time as MAME can cause slowness. 
# Try increasing or decreasing frameskip
# It is possible that you have a virus or spyware on your computer
# Some games require more CPU power at certain times in the game than other times.
==Does MAME benefit from SMP (symmetric multiprocessing) / HT (Hyper-Threading) / dual cores?==
Recent versions of MAME include a -mt switch which allows some tasks to be threaded off for use by SMP or multicore systems.  Thus far the benefits from this are relatively small, because accurate emulation such as MAME strives for cannot easily be broken up into parallel subtasks (it would be like trying to have a baby in one month by impregnating nine women).  There are exceptions of course, and MAME will support them via this mechanism in the future.
==Why is MAME so slow? These games ran at less than 200 MHz, and my CPU is 2 GHz!==
You are comparing apples and oranges.
MAME emulates every function of the emulated CPU(s), video hardware, audio hardware, and anything else on the board (including potentially IDE or SCSI harddisks and CD-ROMs).  This is simply not something that can be done quickly in a high-quality fashion.
==Why don't the developers put more hacks in MAME?==
Hacks, while maybe appearing to be good in a short perspective, are always bad and destructive in the long perspective. The more hacks you put into the code, the harder it becomes to make new additions neatly as the hacks will require workaround hacks, so you'll end up on a downward slope of more and more crappy hacks, until everything collapses under its own weight.  Hack-based emulators typically have a short life because it quickly becomes impossible to debug or extend them.
==Why does MAME become slower all the time?==
Contrary to popular belief, the amount of drivers or the size of the executable does not make MAME slower.
The point is that the drivers are constantly improved and the improved emulation is more accurate to the actual original hardware so for MAME's purposes it's superior. Emulation accuracy trumps playability concerns in MAME.
Another thing to consider is a paradigm called "moving the optimization point". MAME's "sweet spot" is currently aimed at hardware with tilemaps, sprites, more than 256 colors on screen, and at least 2 CPUs, which is a common late-80s paradigm. Real-world examples of this include the Konami Twin16 games, the Sega X and Y boards, Namco System 2, Taito Z System, etc. It means that MAME makes more advanced games run faster at the expense of simpler hardware. The simpler hardware will work out in the end anyway due to ever-faster PCs (Pac-Man is very sub-optimal now compared with [[MAME 0.29]] for instance, but almost any average modern system runs it with 100% speed).

Revision as of 02:53, 2 June 2016