Dynamic recompilation

Dynamic recompilation is a virtual machine implementation approach used to speed up execution of programs that are run in emulation.

Description
To execute a program written for another computer architecture, the emulator translates (recompiles) the existing into native code for the current system. This process is significantly slower than running pre-existing native software. A dynamic recompiler will save the translated code to cache memory or the drive, so that the next time the recompiled code is run, there is no longer a performance penalty from the translation process.

History
The original Mac 68k emulator by Gary Davidian at Apple Computer utilized on PowerPC processors. Eric Traut updated this to run 68k code more efficiently on PCI-based Power Macintosh models through dynamic recompilation. Traut's work on the project led to a on the process. He later joined Connectix, which also produced a dynamic recompiler called Speed Doubler to improve emulation performance on early PowerPC Macs.

Issues
With the introduction of Macs with Apple M1 processors in November 2020, Apple introduced Rosetta 2 to recompile Intel code to run on Apple processors. However, some users expressed concern that the swap files being generated by the translation of non-native code were wearing out the life expectancy of Macs' solid-state drives, especially in base models configured with less RAM. This issue was addressed by Apple in the macOS 11.4 update.