forked from Tessil/hash-table-shootout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcharts-template.html
357 lines (272 loc) · 16.3 KB
/
charts-template.html
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<html>
<head>
<!--[if IE]><script language="javascript" type="text/javascript" src="./excanvas.min.js"></script><![endif]-->
<script language="javascript" type="text/javascript" src="./jquery.js"></script>
<script language="javascript" type="text/javascript" src="./jquery.flot.js"></script>
</head>
<body>
<script>
$("<div id='tooltip'></div>").css({
position: "absolute",
display: "none",
border: "1px solid #fdd",
padding: "2px",
"background-color": "#fee",
opacity: 0.80
}).appendTo("body");
series_settings = {
lines: { show: true },
points: { show: true }
};
grid_settings = { tickColor: '#ddd', hoverable: true };
xaxis_settings = {
tickFormatter: function(num, obj) {
if(num >= 1000*1000) {
return parseFloat(num/(1000*1000)).toFixed(2) + 'M';
}
else {
return parseInt(num/1000) + 'k';
}
}
};
yaxis_runtime_settings = {
tickFormatter: function(num, obj) { return (+num.toFixed(2)) + ' sec.'; }
};
yaxis_memory_settings = {
tickFormatter: function(num, obj) { return parseInt(num/1024/1024) + 'MiB'; }
};
legend_settings = {
position: 'nw',
backgroundOpacity: 0
};
runtime_settings = {
series: series_settings,
grid: grid_settings,
xaxis: xaxis_settings,
yaxis: yaxis_runtime_settings,
legend: legend_settings
};
memory_settings = {
series: series_settings,
grid: grid_settings,
xaxis: xaxis_settings,
yaxis: yaxis_memory_settings,
legend: legend_settings
};
__CHART_DATA_GOES_HERE__
function plot_chart(dataset, chart_container, choices_container, chart_settings, redraw_only = false) {
if(!redraw_only) {
// Set colors
var color = 0;
$.each(dataset, function(key, val) {
val.color = color;
color++;
});
// Insert checkboxes
$.each(dataset, function(key, val) {
checked = '';
if(default_programs_show.indexOf(val.program) > -1) {
checked = 'checked';
}
$(choices_container).append(
"<li><input type='checkbox' value='" + key +"' name='" + val.program + "' " + checked + "></input>" +
"<label for='id" + key + "'>" + val.label + "</label></li>");
});
$(choices_container).find("input").change(plot_according_to_choices);
}
function plot_according_to_choices() {
var data = [];
$(choices_container).find("input:checked").each(
function () {
var key = $(this).attr("value");
if (key && dataset[key]) {
data.push(dataset[key]);
}
}
);
$.plot(chart_container, data, chart_settings);
$(chart_container).bind("plothover", function (event, pos, item) {
if (item) {
var x = item.datapoint[0];
var y = item.datapoint[1].toFixed(4) + "s";
if(chart_settings == memory_settings) {
y = (item.datapoint[1]/1024/1024).toFixed(2) + " MiB";
}
var load_factor = item.series.data[item.dataIndex][2]
if(load_factor == 0.0) {
load_factor = "unknown"
}
$("#tooltip").html("" + y + " ; " + x +
"<br\>" + load_factor + " load factor" +
"<br\>" + item.series.label)
.css({top: item.pageY+5, left: item.pageX+5})
.fadeIn(200);
} else {
$("#tooltip").hide();
}
});
}
plot_according_to_choices();
}
function plot_all_charts(redraw_only = false) {
plot_chart(chart_data['insert_random_shuffle_range_runtime'], '#insert_random_shuffle_range_runtime', '#insert_random_shuffle_range_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_random_shuffle_range_runtime'], '#read_random_shuffle_range_runtime', '#read_random_shuffle_range_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_random_full_runtime'], '#insert_random_full_runtime', '#insert_random_full_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_random_full_reserve_runtime'], '#insert_random_full_reserve_runtime', '#insert_random_full_reserve_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_random_full_runtime'], '#read_random_full_runtime', '#read_random_full_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_miss_random_full_runtime'], '#read_miss_random_full_runtime', '#read_miss_random_full_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_random_full_after_delete_runtime'], '#read_random_full_after_delete_runtime', '#read_random_full_after_delete_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['iteration_random_full_runtime'], '#iteration_random_full_runtime', '#iteration_random_full_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['delete_random_full_runtime'], '#delete_random_full_runtime', '#delete_random_full_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_random_full_memory'], '#insert_random_full_memory', '#insert_random_full_memory_choices', memory_settings, redraw_only);
plot_chart(chart_data['insert_random_full_reserve_memory'], '#insert_random_full_reserve_memory', '#insert_random_full_reserve_memory_choices', memory_settings, redraw_only);
plot_chart(chart_data['insert_small_string_runtime'], '#insert_small_string_runtime', '#insert_small_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_small_string_reserve_runtime'], '#insert_small_string_reserve_runtime', '#insert_small_string_reserve_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_small_string_runtime'], '#read_small_string_runtime', '#read_small_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_miss_small_string_runtime'], '#read_miss_small_string_runtime', '#read_miss_small_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_small_string_after_delete_runtime'], '#read_small_string_after_delete_runtime', '#read_small_string_after_delete_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['delete_small_string_runtime'], '#delete_small_string_runtime', '#delete_small_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_small_string_memory'], '#insert_small_string_memory', '#insert_small_string_memory_choices', memory_settings, redraw_only);
plot_chart(chart_data['insert_small_string_reserve_memory'], '#insert_small_string_reserve_memory', '#insert_small_string_reserve_memory_choices', memory_settings, redraw_only);
plot_chart(chart_data['insert_string_runtime'], '#insert_string_runtime', '#insert_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_string_reserve_runtime'], '#insert_string_reserve_runtime', '#insert_string_reserve_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_string_runtime'], '#read_string_runtime', '#read_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_miss_string_runtime'], '#read_miss_string_runtime', '#read_miss_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['read_string_after_delete_runtime'], '#read_string_after_delete_runtime', '#read_string_after_delete_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['delete_string_runtime'], '#delete_string_runtime', '#delete_string_runtime_choices', runtime_settings, redraw_only);
plot_chart(chart_data['insert_string_memory'], '#insert_string_memory', '#insert_string_memory_choices', memory_settings, redraw_only);
plot_chart(chart_data['insert_string_reserve_memory'], '#insert_string_reserve_memory', '#insert_string_reserve_memory_choices', memory_settings, redraw_only);
}
$(function () {
// Set global choices boxes
var i = 0;
for(var program in programs) {
checked = '';
if(default_programs_show.indexOf(program) > -1) {
checked = 'checked';
}
$("#global_choices").append("<li><input type='checkbox' id='global_choice_" + i + "' " +
checked + "></input>" + programs[program] + "</li>");
$("#global_choice_" + i).change({name: program}, function(event) {
$("input[name='" + event.data.name + "']").prop('checked', this.checked).change();
});
i++;
}
// Set select all link
$("#global_select_all_none").append("<a href='javascript:void(0);' id='global_select_all'>all</a> ");
$("#global_select_all").click(function() {
$("input").prop('checked', true);
plot_all_charts(true);
});
// Set select none link
$("#global_select_all_none").append(" <a href='javascript:void(0);' id='global_select_none'>none</a>");
$("#global_select_none").click(function() {
$("input").prop('checked', false);
plot_all_charts(true);
});
// Draw charts
plot_all_charts();
});
</script>
<style>
div.global {
margin: auto;
width: 800px;
}
div.global_select_all_none {
text-align: center;
}
div.chart {
width: 750px;
height: 500px;
}
div.xaxis-title {
width: 750px;
text-align: center;
font-style: italic;
font-size: small;
color: #666;
}
.choices li {
margin-left: 5%;
display: inline-block;
width: 45%;
}
</style>
<div class="global">
<h2>Global selection</h2>
<ul class="choices" id="global_choices"></ul>
<div class="global_select_all_none" id="global_select_all_none"></div>
<h2>Integers</h2>
<p>For the integers tests, we use hash maps with int64_t as key and int64_t as value.</p>
<h3>Random shuffle inserts: execution time (integers)</h3>
<p>Before the test, we generate a vector with the values [0, nb_entries) and shuffle this vector.
Then for each value k in the vector, we insert the key-value pair (k, 1) in the hash map.</p>
<div class="chart" id="insert_random_shuffle_range_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="insert_random_shuffle_range_runtime_choices"></ul>
<h3>Random full inserts: execution time (integers)</h3>
<p>Before the test, we generate a vector of nb_entries size where each value is randomly taken from an uniform random number generator from all possible positive values an int64_t can hold.
Then for each value k in the vector, we insert the key-value pair (k, 1) in the hash map.</p>
<div class="chart" id="insert_random_full_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="insert_random_full_runtime_choices"></ul>
<h3>Random full inserts with reserve: execution time (integers)</h3>
<p>Same as the random full inserts test but the reserve method of the hash map is called beforehand to avoid any rehash during the insertion.
It provides a fair comparison even if the growth factor of each hash map is different.</p>
<div class="chart" id="insert_random_full_reserve_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="insert_random_full_reserve_runtime_choices"></ul>
<h3>Random full deletes: execution time (integers)</h3>
<p>Before the test, we insert nb_entries elements in the same way as in the random full insert test.
We then delete each key one by one in a different and random order than the one they were inserted.</p>
<div class="chart" id="delete_random_full_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="delete_random_full_runtime_choices"></ul>
<h3>Random shuffle reads: execution time (integers)</h3>
<p>Before the test, we insert nb_entries elements in the same way as in the random shuffle inserts test.
We then read each key-value pair in a different and random order than the one they were inserted.</p>
<div class="chart" id="read_random_shuffle_range_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="read_random_shuffle_range_runtime_choices"></ul>
<h3>Random full reads: execution time (integers)</h3>
<p>Before the test, we insert nb_entries elements in the same way as in the random full inserts test.
We then read each key-value pair in a different and random order than the one they were inserted.</p>
<div class="chart" id="read_random_full_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="read_random_full_runtime_choices"></ul>
<h3>Random full reads misses: execution time (integers)</h3>
<p>Before the test, we insert nb_entries elements in the same way as in the random full inserts test.
We then generate another vector of nb_entries random elements different from the inserted elements and
we try to search for these unknown elements in the hash map.</p>
<div class="chart" id="read_miss_random_full_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="read_miss_random_full_runtime_choices"></ul>
<h3>Random full reads after deleting half: execution time (integers)</h3>
<p>Before the test, we insert nb_entries elements in the same way as in the random full inserts test
before deleting half of these values randomly. We then try to read all the original values in a
different order which will lead to 50% hits and 50% misses.</p>
<div class="chart" id="read_random_full_after_delete_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="read_random_full_after_delete_runtime_choices"></ul>
<h3>Random full iteration: execution time (integers)</h3>
<p>Before the test, we insert nb_entries elements in the same way as in the random full inserts test.
We then use the hash map iterators to read all the key-value pairs.</p>
<div class="chart" id="iteration_random_full_runtime"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="iteration_random_full_runtime_choices"></ul>
<h3>Memory usage of random full inserts (integers)</h3>
<p>Before the random full inserts benchmark finishes, we measure the memory that the hash map is using.</p>
<div class="chart" id="insert_random_full_memory"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="insert_random_full_memory_choices"></ul>
<h3>Memory usage of random full inserts with reserve (integers)</h3>
<p>Before the random full inserts with reserve benchmark finishes, we measure the memory that the hash map is using.
The benchmark is similar to the one above but without measuring the memory fragmentation that the rehash process
may cause.</p>
<div class="chart" id="insert_random_full_reserve_memory"></div>
<div class="xaxis-title">number of entries in hash table</div>
<ul class="choices" id="insert_random_full_reserve_memory_choices"></ul>
</div>
</body>
</html>