This repository was archived by the owner on Feb 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbenchmarks.sh
More file actions
executable file
·140 lines (99 loc) · 3.95 KB
/
benchmarks.sh
File metadata and controls
executable file
·140 lines (99 loc) · 3.95 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
set -euo pipefail
bin="dist/build/benchmark-skiplist/benchmark-skiplist"
n=100000
step=10000
mkdir -p benchmarks
function repeat() {
base=$1
action=$2
target=$3
counter=$step
while [ $counter -lt 110000 ]; do
$base $counter $action $counter >> $target
let counter=$counter+$step
done
}
echo "# 0.1 5" > benchmarks/pnewlayer.txt
repeat "$bin skiplist 0.1 5 1" add benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "pnewlayer - Done"
echo "# 0.2 7" >> benchmarks/pnewlayer.txt
repeat "$bin skiplist 0.2 7 1" add benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "# 0.3 10" >> benchmarks/pnewlayer.txt
repeat "$bin skiplist 0.3 10 1" add benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "# 0.4 13" >> benchmarks/pnewlayer.txt
repeat "$bin skiplist 0.4 13 1" add benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "# 0.5 17" >> benchmarks/pnewlayer.txt
repeat "$bin skiplist 0.5 17 1" add benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "" >> benchmarks/pnewlayer.txt
echo "# 0.6 23" >> benchmarks/pnewlayer.txt
repeat "$bin skiplist 0.6 23 1" add benchmarks/pnewlayer.txt
echo "pnewlayer - Done"
echo "# 1" > benchmarks/speedup.txt
repeat "$bin skiplist 0.3 10 1" add benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# 2" >> benchmarks/speedup.txt
repeat "$bin skiplist 0.3 10 2" add benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# 4" >> benchmarks/speedup.txt
repeat "$bin skiplist 0.3 10 4" add benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# 8" >> benchmarks/speedup.txt
repeat "$bin skiplist 0.3 10 8" add benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# 16" >> benchmarks/speedup.txt
repeat "$bin skiplist 0.3 10 16" add benchmarks/speedup.txt
echo "speedup - Done"
echo "# Skiplist" > benchmarks/add-random.txt
repeat "$bin skiplist 0.3 10 4" add benchmarks/add-random.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# Binarytree" >> benchmarks/add-random.txt
repeat "$bin binarytree 4" add benchmarks/add-random.txt
echo "random add - Done"
echo "# Skiplist" > benchmarks/sorted-add.txt
repeat "$bin skiplist 0.3 10 4" sorted-add benchmarks/sorted-add.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# Binarytree" >> benchmarks/sorted-add.txt
repeat "$bin binarytree 4" sorted-add benchmarks/sorted-add.txt
echo "sorted add - Done"
echo "# Skiplist" > benchmarks/remove.txt
repeat "$bin skiplist 0.3 10 4" remove benchmarks/remove.txt
echo "" >> benchmarks/speedup.txt
echo "" >> benchmarks/speedup.txt
echo "# Binarytree" >> benchmarks/remove.txt
repeat "$bin binarytree 4" remove benchmarks/remove.txt
echo "remove - Done"
echo "# Skiplist - Scenario 1" > benchmarks/scenarios.txt
$bin skiplist 0.3 10 4 $n mix1 0 >> benchmarks/scenarios.txt
echo "# Binarytree - Scenario 1" >> benchmarks/scenarios.txt
$bin binarytree 4 $n mix1 0.5 >> benchmarks/scenarios.txt
echo "" >> benchmarks/scenarios.txt
echo "" >> benchmarks/scenarios.txt
echo "Scenario 1 - Done"
echo "# Skiplist - Scenario 2" >> benchmarks/scenarios.txt
$bin skiplist 0.3 10 4 $n mix2 1.5 >> benchmarks/scenarios.txt
echo "# Binary Tree - Scenario 2" >> benchmarks/scenarios.txt
$bin binarytree 4 $n mix2 2 >> benchmarks/scenarios.txt
echo "" >> benchmarks/scenarios.txt
echo "" >> benchmarks/scenarios.txt
echo "Scenario 2 - Done"
echo "# Skiplist - Scenario 3" >> benchmarks/scenarios.txt
$bin skiplist 0.3 10 4 $n mix3 3 >> benchmarks/scenarios.txt
echo "# Binary Tree - Scenario 3" >> benchmarks/scenarios.txt
$bin binarytree 4 $n mix3 3.5 >> benchmarks/scenarios.txt
echo "Scenario 3 - Done"