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 3fb7f5e was
3fb7f5e,
checked in by Aaron Moss <a3moss@…>, 7 years ago
|
Update benchmarks, cleanup edits to the evaluation section
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Rev | Line | |
---|
[87c5f40] | 1 | #include <stdlib> |
---|
[309be81] | 2 | #include <stdlib.h> |
---|
[0d10090] | 3 | #include <stdio.h> |
---|
[87c5f40] | 4 | #include "pair" |
---|
[309be81] | 5 | #include "bench.h" |
---|
| 6 | #include "cfa-stack.h" |
---|
[0d10090] | 7 | #include "cfa-print.h" |
---|
[309be81] | 8 | |
---|
| 9 | int main(int argc, char** argv) { |
---|
[3fb7f5e] | 10 | FILE* out = fopen("cfa-out.txt", "w"); |
---|
[309be81] | 11 | srand(20171025); |
---|
| 12 | |
---|
| 13 | stack(int) s; |
---|
| 14 | REPEAT_TIMED( "push_int", |
---|
| 15 | push( &s, rand() ); |
---|
| 16 | ) |
---|
[122aecd] | 17 | |
---|
| 18 | stack(int) t; |
---|
| 19 | TIMED( "copy_int", |
---|
| 20 | t = s; |
---|
| 21 | ) |
---|
| 22 | |
---|
| 23 | TIMED( "clear_int", |
---|
| 24 | clear( &s ); |
---|
| 25 | ) |
---|
| 26 | |
---|
[87c5f40] | 27 | int max = 0; |
---|
[122aecd] | 28 | REPEAT_TIMED( "pop_int", |
---|
[87c5f40] | 29 | max = max( max, pop( &t ) ); |
---|
| 30 | ) |
---|
[3fb7f5e] | 31 | print( out, max, "\n" ); |
---|
| 32 | |
---|
| 33 | REPEAT_N_TIMED( "print_int", N/2, |
---|
| 34 | print( out, rand(), ":", rand(), "\n" ); |
---|
| 35 | ) |
---|
[87c5f40] | 36 | |
---|
[ff178ee] | 37 | stack(pair(_Bool, char)) s2; |
---|
[87c5f40] | 38 | REPEAT_TIMED( "push_bool_char", |
---|
[ff178ee] | 39 | push( &s2, (pair(_Bool, char)){ rand() & 0x1, rand() & 0x7F } ); |
---|
[87c5f40] | 40 | ) |
---|
| 41 | |
---|
[ff178ee] | 42 | stack(pair(_Bool, char)) t2; |
---|
[87c5f40] | 43 | TIMED( "copy_bool_char", |
---|
| 44 | t2 = s2; |
---|
| 45 | ) |
---|
| 46 | |
---|
| 47 | TIMED( "clear_bool_char", |
---|
| 48 | clear( &s2 ); |
---|
| 49 | ) |
---|
| 50 | |
---|
[ff178ee] | 51 | pair(_Bool, char) max2 = { (_Bool)0, '\0' }; |
---|
[87c5f40] | 52 | REPEAT_TIMED( "pop_bool_char", |
---|
| 53 | max2 = max( max2, pop( &t2 ) ); |
---|
[122aecd] | 54 | ) |
---|
[3fb7f5e] | 55 | print( out, max2, "\n" ); |
---|
[0d10090] | 56 | |
---|
[3fb7f5e] | 57 | REPEAT_N_TIMED( "print_pair", N/2, |
---|
[0d10090] | 58 | print( out, (pair(_Bool, char)){ rand() & 0x1, rand() & 0x7F }, ":", |
---|
| 59 | (pair(_Bool, char)){ rand() & 0x1, rand() & 0x7F }, "\n" ); |
---|
| 60 | ) |
---|
| 61 | fclose(out); |
---|
[309be81] | 62 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.