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

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 79b8dc3 was 79b8dc3, checked in by Aaron Moss <a3moss@…>, 7 years ago

Some compaction of benchmark code

  • Property mode set to 100644
File size: 912 bytes
Line 
1#include <stdlib>
2#include <stdio.h>
3#include "pair"
4#include "bench.h"
5#include "cfa-stack.h"
6#include "cfa-print.h"
7
8int main( int argc, char *argv[] ) {
9        FILE * out = fopen( "cfa-out.txt", "w" );
10        int max = 0;
11        stack(int) s, t;
12        REPEAT_TIMED( "push_int", push( &s, _i ); )
13        TIMED( "copy_int", t = s; )
14        TIMED( "clear_int", clear( &s ); )
15        REPEAT_TIMED( "pop_int", max = max( max, pop( &t ) ); )
16        REPEAT_TIMED( "print_int", print( out, _i, ":", _i, "\n" ); )
17
18        stack(pair(_Bool, char)) s1, t1;
19        pair(_Bool, char) max = { (_Bool)0, '\0' };
20        REPEAT_TIMED( "push_pair", push( &s1, (pair(_Bool, char)){ _i & 1, _i &0x7F } ); )
21        TIMED( "copy_pair", t1 = s1; )
22        TIMED( "clear_pair", clear( &s1 ); )
23        REPEAT_TIMED( "pop_pair", max = max( max, pop( &t1 ) ); )
24        REPEAT_TIMED( "print_pair",
25                 print( out, (pair(_Bool, char)){  _i & 1, _i &0x7F }, ":", (pair(_Bool, char)){  _i & 1, _i &0x7F }, "\n" ); )
26        fclose(out);
27}
Note: See TracBrowser for help on using the repository browser.