source: doc/papers/general/evaluation/cpp-bench.cpp @ f3d2a4f

Last change on this file since f3d2a4f was fb2ce27, checked in by Aaron Moss <a3moss@…>, 7 years ago

Update all benchmarks to match new CFA

  • Property mode set to 100644
File size: 638 bytes
Line 
1#include <algorithm>
2#include "bench.hpp"
3#include "cpp-stack.hpp"
4#include "cpp-pair.hpp"
5
6int main(int argc, char** argv) {
7        int maxi = 0, vali = 42;
8        stack<int> si, ti;
9       
10        REPEAT_TIMED( "push_int", N, si.push( vali ); )
11        TIMED( "copy_int", ti = si; )
12        TIMED( "clear_int", si.clear(); )
13        REPEAT_TIMED( "pop_int", N, maxi = std::max( maxi, ti.pop() ); )
14
15        pair<short, char> maxp = { 0, '\0' }, valp = { 42, 'a' };
16        stack<pair<short, char>> sp, tp;
17       
18        REPEAT_TIMED( "push_pair", N, sp.push( valp ); )
19        TIMED( "copy_pair", tp = sp; )
20        TIMED( "clear_pair", sp.clear(); )
21        REPEAT_TIMED( "pop_pair", N, maxp = std::max( maxp, tp.pop() ); )
22}
Note: See TracBrowser for help on using the repository browser.