====== MBBSEmu Performance ====== MBBSEmu, an emulator designed for running The Major BBS/Worldgroup modules, is engineered around a simulated x86 processor architecture. This emulation is pivotal as it faithfully recreates the operational environment for which these modules were originally developed. At the heart of MBBSEmu's functionality lies its CPU core, which opts for an interpreter-based approach rather than Just-In-Time (JIT) compilation for executing emulated code. This design choice offers a notable advantage in terms of simplifying the debugging process of emulated code. Debugging is more straightforward with an interpreter as it translates and executes code line-by-line, offering greater visibility into the execution process. However, this method typically yields slower performance compared to executing native code on the host system, as it involves an additional layer of translation. Despite this potential drawback in speed, MBBSEmu benefits from several factors that mitigate the impact of its interpreter-based approach. One of the key innovations in MBBSEmu is its adoption of an Event Driven model for processing system events, as opposed to the continuous loop mechanism utilized by the original software. This modern architectural choice significantly enhances efficiency. In practical terms, even when running over ten modules simultaneously, MBBSEmu maintains a remarkably low footprint, typically utilizing less than 1% of the CPU resources on contemporary computer systems. This efficiency demonstrates the emulator's optimized handling of system events and tasks, which is a substantial improvement over the original software design. Additionally, the context in which The Major BBS and Worldgroup software were developed is crucial for understanding MBBSEmu's performance capabilities. These systems were originally written over three decades ago, a period during which computing hardware was significantly less powerful than today's standards. Modern computer systems, with their advanced processing capabilities, can easily surpass the performance levels of the hardware available at that time. This means that even with the use of an interpreter-based emulator, which is inherently slower than JIT compilation, the performance of MBBSEmu on current hardware is more than sufficient to match, and often exceed, the performance of The Major BBS and Worldgroup on their original hardware. In summary, MBBSEmu's design, which prioritizes ease of debugging through an interpreter-based CPU core, does not significantly impede performance due to the inherent efficiency of its event-driven architecture and the comparatively modest hardware requirements of the original software it emulates. Consequently, MBBSEmu can deliver a seamless emulation experience on modern computing systems, demonstrating the successful adaptation of legacy software to contemporary hardware environments. ===== MBBSEmu Performance Benchmark ===== Within the MBBSEmu source code, a specialized benchmark tool has been developed to assess the core performance of the emulated CPU, located in the [[https://github.com/mbbsemu/MBBSEmu/tree/master/MBBSEmu.CPU.Benchmark|MBBSEmu.CPU.Benchmark project]]. This benchmark is designed to evaluate the "Instructions Per Second" rate that the emulated CPU core is capable of executing. The core of this benchmark is a succinct and continuous loop, delineated as follows in the assembly code snippet 'benchmark.asm': reset: MOV _word_ptr[0], 1 //Set Memory Value to 1 loop: MOV AX, _word_ptr[0] //Move Memory Value into AX CMP AX, 0x7FFF //Compare AX to 0x7FFF JE reset //If Equal, Reset memory value back to 1 INC _word_ptr[0] //Otherwise increment the value in memory by 1 JMP loop //Continue the Loop This looping structure is selected for the benchmarking process due to its ability to engage various critical operations that are integral to CPU performance assessment: - It involves both reading from and writing to registers. - It executes memory read/write operations. - The loop includes arithmetic operations, here exemplified by the CMP instruction, and flag evaluations, as seen in the JE (Jump if Equal) instruction. - It incorporates both conditional (JE) and unconditional (JMP) jumps, allowing for a comprehensive examination of the CPU's ability to handle various control flow scenarios. Through this compact yet effective loop, the benchmark provides a thorough evaluation of the CPU's capabilities in handling typical operations that would be encountered in a real-world emulation scenario. ===== Performance Comparison Chart ===== The chart presented below offers a comparative analysis of contemporary platforms, focusing on their emulation performance. Additionally, it includes a comparison with older hardware systems that exhibit similar performance attributes. ^ Modern CPU ^ Performance ([[https://en.wikipedia.org/wiki/Instructions_per_second#Millions_of_instructions_per_second_(MIPS)|MIPS]]) ^ Comparable To ^ | Raspberry Pi 4 (64-bit, 1.5Ghz) | 6.3 MIPS | 386DX @ 25Mhz | | Intel Xeon E5-2680v4 (3.3Ghz) | 22.2 MIPS | 486DX @ 33Mhz | | Intel i7-10870H (4.2Ghz) | 33.4 MIPS | 486DX @ 50Mhz | | Intel i9-9900k (4.6Ghz) | 39 MIPS | 486DX @ 66Mhz | | Apple M2 Pro (2Ghz) | 56 MIPS | 486DX2 @ 66Mhz | //Performance Numbers as of [[https://github.com/mbbsemu/MBBSEmu/releases/tag/v1.0-alpha-112423|v1.0-alpha-112423]]//