source: doc/papers/general/evaluation/cpp-vbench.cpp @ 1803d4d

ast-experimental
Last change on this file since 1803d4d 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: 783 bytes
Line 
1#include <algorithm>
2#include "bench.hpp"
3#include "cpp-vstack.hpp"
4#include "object.hpp"
5
6int main(int argc, char** argv) {
7        integer maxi{ 0 }, vali{ 42 };
8        stack 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()->as<integer>() ); /***/ )
14
15        ptr<pair> maxp = make<pair>( make<short_integer>(0), make<character>('\0') );
16        pair valp{ make<short_integer>(42), make<character>('a') };
17        stack sp, tp;
18       
19        REPEAT_TIMED( "push_pair", N, sp.push( valp ); )
20        TIMED( "copy_pair", tp = sp; )
21        TIMED( "clear_pair", sp.clear(); )
22        REPEAT_TIMED( "pop_pair", N, 
23                ptr<pair> xp = as_ptr<pair>( tp.pop() ); /***/
24                if ( *xp > *maxp ) { maxp = std::move(xp); } )
25}
Note: See TracBrowser for help on using the repository browser.