|
File TimingX.html Author McKeeman Copyright © 2007 index Timing X Programs and the XCOM CompilerEven though xcom avoids the usual tricks to make the compiler fast or the executable efficient, one can be curious about how it compares with other compilers. If one wished to extend xcom to do serious work, then time tests would be necessary. Timing Executionxcom is instrumented to collect time on its major phases. Use flag -xcomTimeMost ordinary X programs run so fast that the granularity of the clock interfers with accurate measurement. It is reasonable to put the snippet of interest in a loop and run it many times. For example, read the program xcom/x/timeIntegerInc.x. It repeats the snippet ctr := ctr + 1 100,000,000 times. The snippet is cut&paste included 10 times to make sure the loop overhead does not dominate. It does not matter whether the timed program does input/output. All input takes place before execution. All output takes place after execution. The instrumentation separates out these two activities, so slow fingers on the keyboard will show up in a separate category. MATLAB itself is a convenient standard against which to run. The program xcom/times/timeInc.m runs two X programs and then two equivalent (apples-to-apples) M programs. Timing CompilationThe gross measures of front end and back end times are given by the xcom timing flag. Much more detailed information is available via the MATLAB profiler. If your interest is in the internal components of xcom, it makes sense to avoid execution time cluttering the results by using the -noExecuteflag. It is somewhat harder to compare with MATLAB JIT compile time since, once JITted, the MATLAB executable is saved for reuse (unlike xcom). The MATLAB comparison function needs to be cleared before it is run. The R2007b JIT will compile the comparison function (or most of it) the first time. There is no guarantee what future JITs will do. |