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

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 633a642 was 604e76d, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

initial setup for general and concurrency papers

  • Property mode set to 100644
File size: 864 bytes
RevLine 
[604e76d]1#include <algorithm>
2#include <fstream>
3#include "bench.hpp"
4#include "cpp-stack.hpp"
5#include "cpp-pair.hpp"
6#include "cpp-print.hpp"
7
8int main(int argc, char** argv) {
9        std::ofstream out{"/dev/null"};
10        int maxi = 0, vali = 42;
11        stack<int> si, ti;
12       
13        REPEAT_TIMED( "push_int", N, si.push( vali ); )
14        TIMED( "copy_int", ti = si; )
15        TIMED( "clear_int", si.clear(); )
16        REPEAT_TIMED( "pop_int", N, maxi = std::max( maxi, ti.pop() ); )
17        REPEAT_TIMED( "print_int", N/2, print( out, vali, ":", vali, "\n" ); )
18
19        pair<bool, char> maxp = { false, '\0' }, valp = { true, 'a' };
20        stack<pair<bool, char>> sp, tp;
21       
22        REPEAT_TIMED( "push_pair", N, sp.push( valp ); )
23        TIMED( "copy_pair", tp = sp; )
24        TIMED( "clear_pair", sp.clear(); )
25        REPEAT_TIMED( "pop_pair", N, maxp = std::max( maxp, tp.pop() ); )
26        REPEAT_TIMED( "print_pair", N/2, print( out, valp, ":", valp, "\n" ); )
27}
Note: See TracBrowser for help on using the repository browser.