TERRA Datentechnik                                         14-Jan-92
A. Gorrengourt

MultiScope/Logitech M-2 Compiler V4 Beta1:
Some Numbers Relating to Code Size and Compilation Times
--------------------------------------------------------

Note: A exact comparison of code size can only be given when
      we compare the size of the code segment. Neither
      .EXE file size nor .OBJ file size gives an exact measure.
      Therefore we included the utility 'SEGSIZE.EXE' which
      displays the segmentsizes of standard Mircosoft object
      files.

 Compiler Version: V3 = 3.40
 |                 V4 = V4 Beta 1
 | Data Model: M = medium, default used (/DATA:M/CONST:M assumed)
 | |           L = large, options /DATA:L/CONST:L
 | |           In case of V3 only L exists.
 | | Optimization: S (V4) = size, options /opt:scpudjlhv/noopt:t
 | | |             T (V4) = time, default used
 | | |                      (/opt:tcpudjlhv/noopt:s assumed)
 | | |             N (V4) = none, option /noopt
 | | |             O (V3) = default used (/o/os assumed)
 | | |  Debug Info: ND (V4) = no debug, i.e. default used (/nodebug)
 | | |  |            D (V4) = debug, options /debug:me
 | | |  |            - (V3) In case of V3, /nod has been used, but this
 | | |  |                   does not affect the code generated.
 | | |  |  Run-Time Checks: NC = no checks, i.e. default used
 | | |  |  |                     (V4: /nocheck, V3: /t-/r-/s-/f-)
 | | |  |  |                 C = all checks, V4: option /check,
 | | |  |  |                     V3: options /t+/r+/s+/f+
 | | |  |  |      Code Size (Bytes) of Largest Module in Test Program
 | | |  |  |      |      Code Size of Other 14 Modules in Test Program
 | | |  |  |      |      |      Total Code Size of Test Program (sum)
 | | |  |  |      |      |      |     Code Size of Largest Module in %
 | | |  |  |      |      |      |     |  ("V3 L O - NC" taken as 100%)
 | | |  |  |      |      |      |     |     Code Size Other Modules %
 | | |  |  |      |      |      |     |     | ("V3 L O - NC" as 100%)
 | | |  |  |      |      |      |     |     |     Total Code Size in %
 | | |  |  |      |      |      |     |     |     | (V3LO--NC = 100%)

V4 M S ND NC   9214  25654  34868  79.4  86.1  84.2
V4 M T ND NC   9568  26542  36110  82.4  89.0  87.2
V4 M S  D NC  10149  28750  38899  87.4  96.5  93.9
V4 M T  D NC  10592  29685  40277  91.2  99.6  97.2
V4 M N ND NC  10267  30098  40365  88.4 101.0  97.5

V3 L O  - NC  11610  29806  41416 100.0 100.0 100.0

V4 M S ND  C  10932  31545  42477  94.2 105.8 102.6
V4 M T ND  C  11304  32579  43883  97.4 109.3 106.0
V4 M S  D  C  11965  34640  46605 103.1 116.2 112.5
V4 M T  D  C  12404  35687  48091 106.8 119.7 116.1
V4 M N  D  C  12587  36613  49200 108.4 122.8 118.8

V4 L S ND NC  10478  30914  41392  90.2 103.7  99.9
V4 L T ND NC  10848  31969  42817  93.4 107.3 103.4
V4 L S  D NC  11406  34065  45471  98.2 114.3 109.8
V4 L T  D NC  11873  35083  46956 102.3 117.7 113.4
V4 L N ND NC  11532  35509  47041  99.3 119.1 113.6

V3 L O  -  C  13223  37192  50415 113.9 124.8 121.7

V4 L S ND  C  12852  38075  50927 110.7 127.7 123.0
V4 L T ND  C  13240  39268  52508 114.0 131.7 126.8
V4 L S  D  C  13964  41391  55355 120.3 138.9 133.7
V4 L T  D  C  14427  42535  56962 124.3 142.7 137.5
V4 L N  D  C  14582  43473  58055 125.6 145.9 140.2

CONST size      524   3870   4394
(subtracted from code size displayed by V3)

Comments Relating to Code Size:

(1) The average maximum improvement in code size of version 4
    compared to version 3 is about 15%. In specific cases, e.g.
    for the largest module of the test program, it may even be
    20% or more.
(2) Compiling with/without debug info in V4 makes a difference of
    about 10% in code size.
(3) Compiling with/without run-time check code in V4 makes a difference
    of about 20% in code size. It is interesting to note, that this
    also applies to version 3.
(4) In consequence, compiling for testing with debug info and run-time
    checks makes a difference of about 25 - 30% compared to the smallest
    code possible.
(5) Compiling for the large memory model in V4 makes a difference of
    about 15% compared to medium model code.
(6) The average large memory model code generated by V4 is not really
    smaller than the code generated by V3, although a win of about
    10% may result in some cases ("V4 L S ND NC" for largest module
    of test program).
    --> Late congratulations to the version 3.x/3.40 development
        team for the code quality achieved!
(7) With V4 optimization for space wins about 5% compared to compilation
    with optimization options disabled. When optimizing for time, the
    code size is about the same as without optimization. In specific
    cases, it may even become larger (e.g. "V4 M T  D NC" for largest
    module of test program). Note, however, that these figures are
    based on the "well-written" test program, where optimizations like
    elimination of unreachable code will hardly win much. This is
    probabely different for average user programs.
(8) Even without using specific optimization options, the V4 medium
    model code is about 3% smaller than the best V3 code.
(9) When compiling for testing with debug info and run-time checks,
    the minimum code generated by V4 is about 10% smaller than the
    best V3 code. In that case, without using optimization in V4,
    the code is still about 3 - 5% smaller than the best V3 code.

Remarks Relating to Compilation Time:

Fast compilation is mainly interesting during program development,
i.e. when compiling with debug info and run-time checks. The following
times have been measured for compiling the 15 implementation/program
modules of the test program (i.e. the time for compiling the
definition modules is not included here).

                  Total Code Size in % (from last column of table above)
                  |    Number of Seconds for Compilations
                  |    |

V4 M S  D  C  112.5  192
V4 M N  D  C  118.8  155
V3 L O  D  C  121.7  150  (REF file generated)

V4 M S ND NC   84.2  175
V3 L O ND NC  100.0  120  (without REF file)

(A) Obviously, V4 is a bit slower than V3 in regard to compilation time.
    The last entry in the table is quite remarkable in this respect.
    --> Again, late compliments to the 3.x/3.40 development team!
(B) In V4, the generation of debug info and run-time check code seems
    to increase compilation time by about 10% (compare "V4 M S  D  C"
    to "V4 M S ND NC"). 
(C) In V4, compilation with full optimization (for space) compared
    to disabling optimization seems to increase compilation time by
    about 20% (compare "V4 M S  D  C" to "V4 M N  D  C"). In other
    words: By compiling without optimization, one can save about
    20% of the compilation time.
(D) As suggested by (C), one might prefer to compile in V4 with
    optimization disabled during program development. An additional
    5 - 10% loss in code size might be affordable during development,
    and it is compensated by a 20% reduction of compilation times.
    Using this solution (V4 M N  D  C), the V4 compilation times
    are only slightly longer than the corresponding V3 times
    (V3 L O  D  C).

(E) By using the /NOALIAS compiler option, the size of the code
    generated can be reduced by about 0.4 to 0.7 %.

                               * * *
