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 87c5f40 was
87c5f40,
checked in by Aaron Moss <a3moss@…>, 8 years ago
|
Update benchmarks to include stack of pairs
|
-
Property mode set to
100644
|
File size:
790 bytes
|
Rev | Line | |
---|
[87c5f40] | 1 | #include <stdlib> |
---|
[309be81] | 2 | #include <stdlib.h> |
---|
[87c5f40] | 3 | #include "pair" |
---|
[309be81] | 4 | #include "bench.h" |
---|
| 5 | #include "cfa-stack.h" |
---|
| 6 | |
---|
| 7 | int main(int argc, char** argv) { |
---|
| 8 | srand(20171025); |
---|
| 9 | |
---|
| 10 | stack(int) s; |
---|
| 11 | REPEAT_TIMED( "push_int", |
---|
| 12 | push( &s, rand() ); |
---|
| 13 | ) |
---|
[122aecd] | 14 | |
---|
| 15 | stack(int) t; |
---|
| 16 | TIMED( "copy_int", |
---|
| 17 | t = s; |
---|
| 18 | ) |
---|
| 19 | |
---|
| 20 | TIMED( "clear_int", |
---|
| 21 | clear( &s ); |
---|
| 22 | ) |
---|
| 23 | |
---|
[87c5f40] | 24 | int max = 0; |
---|
[122aecd] | 25 | REPEAT_TIMED( "pop_int", |
---|
[87c5f40] | 26 | max = max( max, pop( &t ) ); |
---|
| 27 | ) |
---|
| 28 | |
---|
| 29 | stack(pair(_Bool, unsigned char)) s2; |
---|
| 30 | REPEAT_TIMED( "push_bool_char", |
---|
| 31 | push( &s2, (pair(_Bool, unsigned char)){ rand() & 0x1, rand() & 0x7F } ); |
---|
| 32 | ) |
---|
| 33 | |
---|
| 34 | stack(pair(_Bool, unsigned char)) t2; |
---|
| 35 | TIMED( "copy_bool_char", |
---|
| 36 | t2 = s2; |
---|
| 37 | ) |
---|
| 38 | |
---|
| 39 | TIMED( "clear_bool_char", |
---|
| 40 | clear( &s2 ); |
---|
| 41 | ) |
---|
| 42 | |
---|
| 43 | pair(_Bool, unsigned char) max2 = { (_Bool)0, '\0' }; |
---|
| 44 | REPEAT_TIMED( "pop_bool_char", |
---|
| 45 | max2 = max( max2, pop( &t2 ) ); |
---|
[122aecd] | 46 | ) |
---|
[309be81] | 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.