#include #include #include "bench.hpp" #include "cpp-vstack.hpp" #include "object.hpp" int main(int argc, char** argv) { srand(20171025); stack s; REPEAT_TIMED( "push_int", s.push( std::make_unique( rand() ) ); ) stack t; TIMED( "copy_int", t = s; ) TIMED( "clear_int", s.clear(); ) integer max; REPEAT_TIMED( "pop_int", max = std::max( max, t.pop()->as() ); ) stack s2; REPEAT_TIMED( "push_bool_char", s2.push( std::make_unique( std::make_unique( rand() & 0x1 ), std::make_unique( rand() & 0x7F ) ) ); ) stack t2; TIMED( "copy_bool_char", t2 = s2; ) TIMED( "clear_bool_char", s2.clear(); ) auto max2 = std::make_unique( std::make_unique(false), std::make_unique('\0') ); REPEAT_TIMED( "pop_bool_char", std::unique_ptr x = t2.pop(); if ( x->as() > *max2 ) { max2.reset( static_cast(x.release()) ); } ) }