Changeset bbe856c


Ignore:
Timestamp:
Apr 14, 2017, 5:03:36 PM (8 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
1504536
Parents:
3895b8b5
Message:

more changes to evaluation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/generic_types.tex

    r3895b8b5 rbbe856c  
    954954Since all these languages share a subset comprising most of standard C, maximal-performance benchmarks would show little runtime variance, other than in length and clarity of source code.
    955955Instead, the presented benchmarks show the costs of idiomatic use of each language's features to examine common usage.
    956 The benchmarks test a generic stack based on a singly linked-list, a generic pair-data-structure, and a variadic @print@ routine similar to that in Section~\ref{sec:variadic-tuples}.
     956Figure~\ref{fig:MicroBenchmark} shows the benchmark tests for a generic stack based on a singly linked-list, a generic pair-data-structure, and a variadic @print@ routine similar to that in Section~\ref{sec:variadic-tuples}.
     957The experiments are:
     958\begin{enumerate}
     959\item
     960N stack pushes of int, where N = 40M
     961\item
     962copy int stack
     963\item
     964clear int stack
     965\item
     966N stack pops of int
     967\end{enumerate}
    957968The structure of each implemented is: C with @void *@-based polymorphism, \CFA with the different presented features, \CC with templates, and \CC using only class inheritance for polymorphism, called \CCV.
    958969The \CCV variant illustrates an alternative object-oriented idiom where all objects inherit from a base @object@ class, mimicking a Java-like interface;
     
    962973Preliminary tests show the difference has little runtime effect.
    963974Finally, the C @rand@ function is used generate random numbers.
     975
     976\begin{figure}
     977\begin{lstlisting}[xleftmargin=3\parindentlnth,aboveskip=0pt,belowskip=0pt,numbers=left,numberstyle=\tt\small,numberblanklines=false]
     978int main( int argc, char *argv[] ) {
     979        int max = 0;
     980        stack(int) s, t;
     981        REPEAT_TIMED( "push_int", push( &s, 42 ); )
     982        TIMED( "copy_int", t = s; )
     983        TIMED( "clear_int", clear( &s ); )
     984        REPEAT_TIMED( "pop_int", max = max( max, pop( &t ) ); )
     985
     986        stack(pair(_Bool, char)) s, t;
     987        pair(_Bool, char) max = { (_Bool)0, '\0' };
     988        REPEAT_TIMED( "push_pair", push( &s, (pair(_Bool, char)){ 42, 42 } ); )
     989        TIMED( "copy_pair", t = s; )
     990        TIMED( "clear_pair", clear( &s ); )
     991        REPEAT_TIMED( "pop_pair", max = max( max, pop( &t ) ); )
     992
     993        FILE * out = fopen( "cfa-out.txt", "w" );
     994        REPEAT_TIMED( "print_int", print( out, 42, ":", 42, "\n" ); )
     995        REPEAT_TIMED( "print_pair",
     996                 print( out, (pair(_Bool, char)){ 42, 42 }, ":", (pair(_Bool, char)){ 42, 42 }, "\n" ); )
     997        fclose(out);
     998}
     999\end{lstlisting}
     1000\caption{Micro-Benchmark}
     1001\label{fig:MicroBenchmark}
     1002\end{figure}
    9641003
    9651004\begin{figure}
     
    10501089SETL~\cite{SETL} is a high-level mathematical programming language, with tuples being one of the primary data types.
    10511090Tuples in SETL allow subscripting, dynamic expansion, and multiple assignment.
    1052 C provides variadic functions through @va_list@ objects, but the programmer is responsible for managing the number of arguments and their types.
     1091C provides variadic functions through @va_list@ objects, but the programmer is responsible for managing the number of arguments and their types, so the mechanism is not type-safe.
    10531092KW-C~\cite{Buhr94a}, a predecessor of \CFA, introduced tuples to C as an extension of the C syntax, taking much of its inspiration from SETL.
    10541093The main contributions of that work were adding MRVF, tuple mass and multiple assignment, and record-field access.
Note: See TracChangeset for help on using the changeset viewer.