Changeset 87c5f40 for doc/generic_types/evaluation/cpp-vbench.cpp
- Timestamp:
- Apr 11, 2017, 5:11:55 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 4f57930
- Parents:
- e6dceef
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/cpp-vbench.cpp
re6dceef r87c5f40 1 #include <algorithm> 1 2 #include <stdlib.h> 2 3 #include "bench.hpp" 3 4 #include "cpp-vstack.hpp" 5 #include "object.hpp" 4 6 5 7 int main(int argc, char** argv) { … … 20 22 ) 21 23 22 integer sum;24 integer max; 23 25 REPEAT_TIMED( "pop_int", 24 sum += t.pop()->as<integer>(); 26 max = std::max( max, t.pop()->as<integer>() ); 27 ) 28 29 stack s2; 30 REPEAT_TIMED( "push_bool_char", 31 s2.push( std::make_unique<pair>( std::make_unique<boolean>( rand() & 0x1 ), 32 std::make_unique<character>( rand() & 0x7F ) ) ); 33 ) 34 35 stack t2; 36 TIMED( "copy_bool_char", 37 t2 = s2; 38 ) 39 40 TIMED( "clear_bool_char", 41 s2.clear(); 42 ) 43 44 pair max2 = { std::make_unique<boolean>(false), std::make_unique<character>('\0') }; 45 REPEAT_TIMED( "pop_bool_char", 46 max2 = std::max( max2, t2.pop()->as<pair>() ); 25 47 ) 26 48 }
Note: See TracChangeset
for help on using the changeset viewer.