Due to the nature of the continuous compilation model, we expect that it will always outperform interpretation if run on a dual-processor system. However, it is more instructive to compare the two when both are run on a single-processor system.
In order to calculate the interpretation time for each program, it was necessary to know how much time the program spent in ``library'' code and how much it spent in ``user'' code. The user code is interpreted, but the library code is precompiled and runs at native-code speed.
The amount of time spent in library code is determined by our continuous compilation simulator. (These values are given in various tables later in this chapter.) Knowing this, we can then subtract from the overall execution time (given in Table 6.2) to determine the amount of time spent in user code. The interpretation time is then calculated from the following equation
where
is the total native-execution time,
is the time
spent in library code, and p is the interpretation penalty.
Table 6.8 compares the performance of ghostview, pico, and render on a single-processor continuous compiler with that of traditional interpretation. We used an interpretation penalty of 10 for both the continuous compiler and the interpreter. The continuous compiler used the replace-preemptive scheme and the largest-first compilation strategy.
Table 6.8: Continuous Compilation vs. Interpretation
With ghostview and especially with render we see the expected improvement. Render in particular shows a huge performance increase--seven times faster--when using continuous compilation instead of traditional interpretation.
Pico, on the other hand, performs worse under single-processor continuous compilation. This is due to the fact that pico spends an overwhelmingly large percentage of time executing precompiled library code. Pico spends 63.444 seconds, out of 63.5 seconds, in library code--more than 99.9%. The continuous compiler loses because it spends half of its time compiling code that is executed for less than 0.1% of the total execution time. However, unlike traditional compilation, the program is being executed concurrently during this time. In fact, the actual execution time of pico under the continuous compiler would probably be closer to the 63.5 seconds since the user would not need to wait for compilation to complete.
In contrast to pico, render and ghostview spend almost all of their time, over 99.9%, executing user code. Any program that spends a fair amount of time in user code will show a gain in performance when comparing continuous compilation to interpretation; and the longer the program runs, the greater the gain will be. This is why render shows such a tremendous gain in performance.