Ignore:
Timestamp:
Apr 17, 2017, 3:47:07 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
4ae83a4b
Parents:
33e22da
Message:

Final version of the benchmark code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/generic_types.tex

    r33e22da rc87cd93  
    964964\begin{figure}
    965965\begin{lstlisting}[xleftmargin=3\parindentlnth,aboveskip=0pt,belowskip=0pt]
    966 int main( int argc, char * argv[] ) {
     966int main( int argc, char *argv[] ) {
    967967        FILE * out = fopen( "cfa-out.txt", "w" );
    968         int max = 0, vali = 42;
     968        int maxi = 0, vali = 42;
    969969        stack(int) si, ti;
    970970
    971         REPEAT_TIMED( "push_int", push( &si, vali ); )
     971        REPEAT_TIMED( "push_int", N, push( &si, vali ); )
    972972        TIMED( "copy_int", ti = si; )
    973973        TIMED( "clear_int", clear( &si ); )
    974         REPEAT_TIMED( "pop_int", max = max( max, pop( &ti ) ); )
    975         REPEAT_TIMED( "print_int", print( out, vali, ":", vali, "\n" ); )
    976 
    977         pair(_Bool, char) maxp  = { (_Bool)0, '\0' }, valp = { (_Bool)0, 'a' };
     974        REPEAT_TIMED( "pop_int", N,
     975                int xi = pop( &ti );
     976                if ( xi > maxi ) { maxi = xi; } )
     977        REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); )
     978
     979        pair(_Bool, char) maxp = { (_Bool)0, '\0' }, valp = { (_Bool)1, 'a' };
    978980        stack(pair(_Bool, char)) sp, tp;
    979981
    980         REPEAT_TIMED( "push_pair", push( &sp, valp ); )
     982        REPEAT_TIMED( "push_pair", N, push( &sp, valp ); )
    981983        TIMED( "copy_pair", tp = sp; )
    982984        TIMED( "clear_pair", clear( &sp ); )
    983         REPEAT_TIMED( "pop_pair", maxp = max( maxp, pop( &tp ) ); )
    984         REPEAT_TIMED( "print_pair", print( out, valp, ":", valp, "\n" ); )
     985        REPEAT_TIMED( "pop_pair", N,
     986                pair(_Bool, char) xp = pop( &tp );
     987                if ( xp > maxp ) { maxp = xp; } )
     988        REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); )
    985989        fclose(out);
    986990}
     
    10081012\begin{tabular}{rrrrr}
    10091013                                                                        & \CT{C}        & \CT{\CFA}     & \CT{\CC}      & \CT{\CCV}             \\ \hline
    1010 maximum memory usage (MB)                       & 10001         & 2501          & 2503          & 11253                 \\
    1011 source code size (lines)                        & 301           & 224           & 188           & 437                   \\
    1012 redundant type annotations (lines)      & 46            & 3                     & 2                     & 15                    \\
    1013 binary size (KB)                                        & 18            & 234           & 18            & 42                    \\
     1014maximum memory usage (MB)                       & 10001         & 2502          & 2503          & 11253                 \\
     1015source code size (lines)                        & 247           & 223           & 165           & 339                   \\
     1016redundant type annotations (lines)      & 39            & 2                     & 2                     & 15                    \\
     1017binary size (KB)                                        & 14            & 229           & 18            & 38                    \\
    10141018\end{tabular}
    10151019\end{table}
Note: See TracChangeset for help on using the changeset viewer.