source:
doc/papers/general/evaluation/cfa-bench.c@
33e4968e
| Last change on this file since 33e4968e was 9d6f011, checked in by , 8 years ago | |
|---|---|
|
|
| File size: 628 bytes | |
| Rev | Line | |
|---|---|---|
| [604e76d] | 1 | #include "bench.h" |
| 2 | #include "cfa-stack.h" | |
| 3 | #include "cfa-pair.h" | |
| 4 | ||
| [28bc8c8] | 5 | int main() { |
| [c9b3a41] | 6 | int max = 0, val = 42; |
| [79d4186] | 7 | stack( int ) si, ti; |
| [604e76d] | 8 | |
| [79d4186] | 9 | REPEAT_TIMED( "push_int", N, push( si, val ); ) |
| [f1f8e55] | 10 | TIMED( "copy_int", ti{ si }; ) |
| [79d4186] | 11 | TIMED( "clear_int", clear( si ); ) |
| [9d6f011] | 12 | REPEAT_TIMED( "pop_int", N, int x = pop( ti ); if ( x > max ) max = x; ) |
| [604e76d] | 13 | |
| [f1f8e55] | 14 | pair( short, char ) max = { 0h, '\0' }, val = { 42h, 'a' }; |
| 15 | stack( pair( short, char ) ) sp, tp; | |
| [604e76d] | 16 | |
| [79d4186] | 17 | REPEAT_TIMED( "push_pair", N, push( sp, val ); ) |
| [f1f8e55] | 18 | TIMED( "copy_pair", tp{ sp }; ) |
| [79d4186] | 19 | TIMED( "clear_pair", clear( sp ); ) |
| [9d6f011] | 20 | REPEAT_TIMED( "pop_pair", N, pair(short, char) x = pop( tp ); if ( x > max ) max = x; ) |
| [604e76d] | 21 | } |
Note:
See TracBrowser
for help on using the repository browser.