forked from whymirror/potion
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgcbench-table.pn
More file actions
50 lines (40 loc) · 964 Bytes
/
gcbench-table.pn
File metadata and controls
50 lines (40 loc) · 964 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
tree_size = (i):
(1 << (i + 1)) - 1.
populate_tree = (node, depth):
if (depth > 0):
depth--
node put("left", list(2))
node put("right", list(2))
populate_tree(node("left"), depth)
populate_tree(node("right"), depth).
.
new_tree = (depth):
x = (left=nil, right=nil)
if (depth > 0):
x put("left", new_tree(depth - 1))
x put("right", new_tree(depth - 1)).
x.
"Stretching memory with a table of depth 20\n" print
temp = new_tree(20)
temp = 0
"Creating a long-lived table of depth 18\n" print
longlived = new_tree(18)
"Creating a long-lived array of 2000000 items\n" print
ary = list(2000000)
i = 4
while (i <= 20):
iter = 2 * tree_size(20) / tree_size(i)
("Creating ", iter, " tables of depth ", i, "\n") join print
j = 0
while (j < iter):
temp = (left=nil, right=nil)
populate_tree(temp, i)
temp = 0
j++.
j = 0
while (j < iter):
temp = new_tree(i)
temp = 0
j++.
i = i + 2.
0