Forth-79 Profiled

The technique of 'profiling' an applications program, that is obtaining statistical data on the length of time that the program spends in each of its component sections, is well known and allows time critical parts to be identified and thus optimized. Less obvious is the possibility that an entire operating system might be profiled. This is hardly practical with the majority of operating systems (even less, compiler), but the simplicity and virtual machine concept of a Forth system does lend itself to the in-depth analysis that profiling will allow. This paper describes such an analysis for a 79-standard Forth system. Results are summarized which detail from high-level words through to the simplest code primitives, including NEXT, a number of different activities of the system. In particular, interpreting, and compiling are profiled. Finally, an analysis which combines the separate results is given showing the overall average activity of the Forth system. Some surprising results are indicated; in particular the amount of time that the system spends in the inner interpreter. Also a number of code primitives turn out to be executed unexpectedly often, while others are executed much less frequently than might be expected. These results have proved to be particularly useful in our quest for a Forth machine architecture, by indicating precisely which aspects of the hardware design need to be given special attention.