- Timestamp:
- Apr 7, 2017, 6:17: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:
- b276be5, c51b5a3
- Parents:
- a0ad7dc
- Location:
- doc/generic_types/evaluation
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/generic_types/evaluation/bench.h
ra0ad7dc rd919f47 1 #pragma once 2 1 3 #include <stdio.h> 2 4 #include <time.h> 3 5 4 // #define N 50000000 5 #define N 5 6 6 #define N 50000000 7 7 8 8 9 long ms_between(clock_t start, clock_t end) { … … 11 12 12 13 #define TIMED(name, code) { \ 13 clock_t start,end; \14 start = clock(); \14 clock_t _start, _end; \ 15 _start = clock(); \ 15 16 code \ 16 end = clock(); \17 printf("%s:\t%7ld ms\n", name, ms_between( start,end)); \17 _end = clock(); \ 18 printf("%s:\t%7ld ms\n", name, ms_between(_start, _end)); \ 18 19 } 19 20 20 #define REPEAT_TIMED(name, code) TIMED( name, for (int i = 0; i < N; ++i) { code } )21 #define REPEAT_TIMED(name, code) TIMED( name, for (int _i = 0; _i < N; ++_i) { code } ) -
doc/generic_types/evaluation/c-stack.c
ra0ad7dc rd919f47 31 31 free(crnt); 32 32 } 33 s->head = NULL; 33 34 } 34 35 -
doc/generic_types/evaluation/c-stack.h
ra0ad7dc rd919f47 1 #pragma once 2 1 3 struct stack_node; 2 4 -
doc/generic_types/evaluation/cfa-stack.c
ra0ad7dc rd919f47 1 #include <assert> 1 2 #include <stdlib> 2 3 #include "cfa-stack.h" … … 9 10 forall(otype T) void ?{}(stack(T)* s) { 10 11 (&s->head){ 0 }; 12 } 13 14 forall(otype T) void copy(stack(T)* s, stack(T)* t) { 15 stack_node(T)** crnt = &s->head; 16 stack_node(T)* next = t->head; 17 while ( next ) { 18 *crnt = ((stack_node(T)*)malloc()){ next->value }; 19 stack_node(T)* acrnt = *crnt; 20 crnt = &acrnt->next; 21 next = next->next; 22 } 23 *crnt = 0; 11 24 } 12 25 … … 57 70 delete(crnt); 58 71 } 72 s->head = 0; 59 73 } -
doc/generic_types/evaluation/cfa-stack.h
ra0ad7dc rd919f47 1 #pragma once 2 1 3 forall(otype T) struct stack_node; 2 4 -
doc/generic_types/evaluation/cpp-stack.h
ra0ad7dc rd919f47 1 #pragma once 2 1 3 #include <utility> 2 4
Note: See TracChangeset
for help on using the changeset viewer.