Ignore:
Timestamp:
Apr 12, 2017, 9:36:33 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
50b7e8c, d9dd3d1
Parents:
ff178ee
Message:

Add printing code to benchmark

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/cpp-vbench.cpp

    rff178ee r0d10090  
    11#include <algorithm>
     2#include <fstream>
    23#include <stdlib.h>
    34#include "bench.hpp"
    45#include "cpp-vstack.hpp"
     6#include "cpp-vprint.hpp"
    57#include "object.hpp"
    68
     
    4547                std::make_unique<character>('\0') );
    4648        REPEAT_TIMED( "pop_bool_char",
    47                 std::unique_ptr<object> x = t2.pop();
    48                 if ( x->as<pair>() > *max2 ) { max2.reset( static_cast<pair*>(x.release()) ); }
     49                std::unique_ptr<pair> x = as_ptr<pair>( t2.pop() );
     50                if ( *x > *max2 ) { max2 = std::move(x); }
     51        )
     52
     53        std::ofstream out{"cpp-vout.txt"};
     54        REPEAT_TIMED( "print_int",
     55                print( out, integer{rand()}, c_string{":"}, integer{rand()}, c_string{"\n"} );
     56        )
     57
     58        REPEAT_TIMED( "print_pair",
     59                print( out, pair{ std::make_unique<boolean>( rand() & 0x1 ),
     60                        std::make_unique<character>( rand() & 0x7F ) }, c_string{":"},
     61                        pair{ std::make_unique<boolean>( rand() & 0x1 ),
     62                        std::make_unique<character>( rand() & 0x7F ) }, c_string{"\n"} );
    4963        )
    5064}
Note: See TracChangeset for help on using the changeset viewer.