A processor that emulates itself - can be faster than itself

The modern world of software contains so many layers that optimizations can be in the most unexpected places. Meet the year 2000, the HP Dynamo project. This is a PA-8000 processor emulator, running on the same PA-8000 processor, but with JIT technology. And real programs running in the emulator end up running faster than on a bare processor.





td; dr - the title says it all





Programmers from HP Labs wondered what would happen if you write an optimizing JIT compiler for the same platform on which it works. The work took several years. It was possible to run unmodified native binaries under the emulator. And the results were somewhat unexpected.





They looked for "hot paths" in the emulator and optimized the code execution flow. Thus, the costs for jumps, calling functions, dynamic libraries, and optimizing work with the processor's cache were reduced. The performance improvement results reached + 22%, the average for the tests turned out to be + 9%.





This short note was written so that someone could learn something new, but there is no point in getting into the very technical details of 20 years ago.





If anyone is interested in the details:





1.http

: //cseweb.ucsd.edu/classes/sp00/cse231/dynamopldi.pdf 2.https ://stackoverflow.com/questions/5641356/why-is-it-that-bytecode-might-run-faster -than-native-code / 5641664 # 5641664 3.https

: //en.wikipedia.org/wiki/Just-in-time_compilation








All Articles