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

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 79d4186 was 79d4186, checked in by Aaron Moss <a3moss@…>, 6 years ago

Update evaluation code for paper

  • Property mode set to 100644
File size: 642 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<bool, char> maxp = { false, '\0' }, valp = { true, 'a' };
16        stack<pair<bool, 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.