When the MPLAB® X Simulator is simulating running in real time, instructions are executing as quickly as the PC's CPU will allow. This is usually slower than the actual device would run at its rated clock speed. The speed at which the simulator runs depends on the speed of your computer and how many other tasks you have running in the background. The software simulator must update all of the simulated registers and RAM, monitor I/O, set and clear flags, check for break and trace points in the software and simulate the embedded instruction with instructions being executed on your computer's CPU.
The execution speed of a discrete-event software simulator is orders of magnitude less than a hardware oriented solution. Slower execution speed may be viewed as a handicap or as a tool. The simulator attempts to provide the fastest possible simulation cycle, and depending upon the mode of operation, the simulator can operate on the order of milliseconds per instruction.
Oftentimes loops are used in your code to generate timing delays. When using the simulator, you might wish to decrease these time delays or conditionally remove those sections of your code with “IFDEF” statements to increase simulation speed.
Turning off simulator trace will increase simulation speed by up to 50%. Therefore, use the tracing function only as needed.
Simulator Trace allows you to record the step-by-step execution of your code and examine this recording. The default is set for 64K records and is recorded internally in RAM to create fast access to the trace buffer. For records larger than 64K, a RAM file buffer (essentially disk space) is used and the speed is much slower. Except when there is no alternative for capturing a large buffer of data, it is recommended that records are kept to less than 64K to minimize the delay.
Displaying Performance Data
You can display simulator performance information by seting its options on the simulator property pages of the Project Properties dialog.
1. Open the Project Properties dialog by doing one of the following:
Click on the project name in the Project window and select File ▶ Project Properties from the main menu.
2. Right click on the project name in the Project window and select “Properties” to display the speed of simulator in the Output window in the number of instruction cycles executed per second.
3. Under “Categories”: click on “Simulator”, select property pages from “Options categories”, click "Performance Options".