Changeset 122aecd for doc/generic_types/evaluation/c-bench.c
- Timestamp:
- Apr 7, 2017, 2:32:03 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:
- 3a48e283
- Parents:
- 4cfcf41
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/c-bench.c
r4cfcf41 r122aecd 2 2 #include "bench.h" 3 3 #include "c-stack.h" 4 5 void* copy_int( void* p ) { 6 int* q = malloc(sizeof(int)); 7 *q = *(int*)p; 8 return q; 9 } 4 10 5 11 int main(int argc, char** argv) { … … 7 13 8 14 struct stack s = new_stack(); 9 10 15 REPEAT_TIMED( "push_int", 11 16 int* x = malloc(sizeof(int)); … … 14 19 ) 15 20 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 ) 17 36 }
Note: See TracChangeset
for help on using the changeset viewer.