Ignore:
Timestamp:
Apr 7, 2017, 2:32:03 PM (7 years ago)
Author:
Aaron Moss <a3moss@…>
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:
3a48e283
Parents:
4cfcf41
Message:

Expand benchmarks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/generic_types/evaluation/c-bench.c

    r4cfcf41 r122aecd  
    22#include "bench.h"
    33#include "c-stack.h"
     4
     5void* copy_int( void* p ) {
     6        int* q = malloc(sizeof(int));
     7        *q = *(int*)p;
     8        return q;
     9}
    410
    511int main(int argc, char** argv) {
     
    713
    814        struct stack s = new_stack();
    9 
    1015        REPEAT_TIMED( "push_int",
    1116                int* x = malloc(sizeof(int));
     
    1419        )
    1520
    16         clear_stack(&s);
     21        struct stack t;
     22        TIMED( "copy_int",
     23                copy_stack(&t, &s, copy_int);
     24        )
     25
     26        TIMED( "clear_int",
     27                clear_stack(&s);
     28        )
     29
     30        int sum;
     31        REPEAT_TIMED( "pop_int",
     32                int* x = pop_stack(&t);
     33                sum += *x;
     34                free(x);
     35        )
    1736}
Note: See TracChangeset for help on using the changeset viewer.