source: doc/generic_types/evaluation/cfa-bench.c @ c87cd93

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since c87cd93 was c87cd93, checked in by Aaron Moss <a3moss@…>, 7 years ago

Final version of the benchmark code

  • Property mode set to 100644
File size: 956 bytes
Line 
1#include <stdlib>
2#include <stdio.h>
3#include "bench.h"
4#include "cfa-stack.h"
5#include "cfa-pair.h"
6#include "cfa-print.h"
7
8int main( int argc, char *argv[] ) {
9        FILE * out = fopen( "cfa-out.txt", "w" );
10        int maxi = 0, vali = 42;
11        stack(int) si, ti;
12
13        REPEAT_TIMED( "push_int", N, push( &si, vali ); )
14        TIMED( "copy_int", ti = si; )
15        TIMED( "clear_int", clear( &si ); )
16        REPEAT_TIMED( "pop_int", N, 
17                int xi = pop( &ti ); 
18                if ( xi > maxi ) { maxi = xi; } )
19        REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); )
20
21        pair(_Bool, char) maxp = { (_Bool)0, '\0' }, valp = { (_Bool)1, 'a' };
22        stack(pair(_Bool, char)) sp, tp;
23
24        REPEAT_TIMED( "push_pair", N, push( &sp, valp ); )
25        TIMED( "copy_pair", tp = sp; )
26        TIMED( "clear_pair", clear( &sp ); )
27        REPEAT_TIMED( "pop_pair", N, 
28                pair(_Bool, char) xp = pop( &tp ); 
29                if ( xp > maxp ) { maxp = xp; } )
30        REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); )
31        fclose(out);
32}
Note: See TracBrowser for help on using the repository browser.