[604e76d] | 1 | #include <stdio.h>
|
---|
| 2 | #include "bench.h"
|
---|
| 3 | #include "cfa-stack.h"
|
---|
| 4 | #include "cfa-pair.h"
|
---|
| 5 | #include "cfa-print.h"
|
---|
| 6 |
|
---|
| 7 | int main( int argc, char *argv[] ) {
|
---|
| 8 | FILE * out = fopen( "/dev/null", "w" );
|
---|
| 9 | int maxi = 0, vali = 42;
|
---|
| 10 | stack(int) si, ti;
|
---|
| 11 |
|
---|
[986dd36] | 12 | REPEAT_TIMED( "push_int", N, push( si, vali ); )
|
---|
[604e76d] | 13 | TIMED( "copy_int", ti = si; )
|
---|
[986dd36] | 14 | TIMED( "clear_int", clear( si ); )
|
---|
| 15 | REPEAT_TIMED( "pop_int", N,
|
---|
| 16 | int xi = pop( ti );
|
---|
[604e76d] | 17 | if ( xi > maxi ) { maxi = xi; } )
|
---|
| 18 | REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); )
|
---|
| 19 |
|
---|
| 20 | pair(_Bool, char) maxp = { (_Bool)0, '\0' }, valp = { (_Bool)1, 'a' };
|
---|
| 21 | stack(pair(_Bool, char)) sp, tp;
|
---|
| 22 |
|
---|
[986dd36] | 23 | REPEAT_TIMED( "push_pair", N, push( sp, valp ); )
|
---|
[604e76d] | 24 | TIMED( "copy_pair", tp = sp; )
|
---|
[986dd36] | 25 | TIMED( "clear_pair", clear( sp ); )
|
---|
| 26 | REPEAT_TIMED( "pop_pair", N,
|
---|
| 27 | pair(_Bool, char) xp = pop( tp );
|
---|
[604e76d] | 28 | if ( xp > maxp ) { maxp = xp; } )
|
---|
| 29 | REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); )
|
---|
| 30 | fclose(out);
|
---|
| 31 | }
|
---|