comparison binary_trees.rhope @ 95:f4fd8962c385

Cleaned up binary trees benchmark, made memory allocator somewhat configurable at compile time
author Mike Pavone <pavone@retrodev.com>
date Mon, 02 Aug 2010 01:55:56 -0400
parents 09831a71a4bc
children d59611dcec71
comparison
equal deleted inserted replaced
94:05c22ff4b4ed 95:f4fd8962c385
52 52
53 Test Sizes[current,max,iterations:out] 53 Test Sizes[current,max,iterations:out]
54 { 54 {
55 sum <- Test Size[0, 1, iterations, current] 55 sum <- Test Size[0, 1, iterations, current]
56 { 56 {
57 Print[[iterations]*[2]] 57 Print[
58 { Print["trees of depth"] 58 [[[[String[[iterations]*[2]]
59 { Print[current] 59 ]Append["\t trees of depth "]
60 { Print["check"] 60 ]Append[String[current]]
61 { Print[sum] 61 ]Append["\t check: "]
62 ]Append[String[sum]]]
62 { 63 {
63 If[[current]=[max]] 64 If[[current]=[max]]
64 { 65 {
65 out <- 1 66 out <- 1
66 }{ 67 }{
67 out <- Test Sizes[[current]+[2], max, [iterations]/[4]] 68 out <- Test Sizes[[current]+[2], max, [iterations]/[4]]
68 } 69 }
69 }}}}} 70 }
70 } 71 }
71 } 72 }
72 73
73 Main[] 74 Main[args]
74 { 75 {
75 min depth <- 4 76 [args]Index[1]
76 max depth <- 16 77 {
77 Print["stretch tree of depth 17 check:"] 78 min depth <- 4
78 { Print[Check Tree[Make Tree[0, 17]]] 79 max depth <- Max[[min depth]+[2], Int32[~]]
79 { long lived <- Make Tree[0, max depth] 80 Print[
80 { Test Sizes[min depth, max depth, [1]LShift[max depth]] 81 [[["stretch tree of depth "
81 { Print["long lived tree of depth 16 check:"] 82 ]Append[String[[max depth]+[1]]]
82 { Print[Check Tree[long lived]] }}}}} 83 ]Append["\t check: "]
84 ]Append[String[Check Tree[Make Tree[0, [max depth]+[1]]]]]]
85 { long lived <- Make Tree[0, max depth]
86 { Test Sizes[min depth, max depth, [1]LShift[max depth]]
87 { Print[
88 [[["long lived tree of depth "
89 ]Append[String[max depth]]
90 ]Append["\t check: "]
91 ]Append[String[Check Tree[long lived]]]] }}}
92 }{
93 Print["you must provide a max depth param"]
94 }
83 } 95 }
84 96