-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
876 lines (714 loc) · 34.6 KB
/
index.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
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>CloudBench: Embedded OALP DB Benchmark</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="icon" href="data:image/gif;base64,R0lGODlhIAAgAOMPAHMUEmkyHOcbF8UvJts/E3BeOih1YziiQmebLt2AFjeyQKqZKNWPjLybfPfcDP///yH5BAEKAA8ALAAAAAAgACAAAATg8MlJ6ws26z0EGcQmZgAhnN6oPg0wDA0zrGMTAADDxEJCZ4Gba8c4hX4Uw+XWeYGOyMdhgkuYrAToqIBQHBCIKQ6wcJhPyINarUBcyuYE+ndQeOsKuNlxmv3CdnZfew5yAlEPC12BhFhZiBJ2CI1GkBMHeoV9PpYPhIUDBqIFnZ8EBaKplqYMqaqIewl8A6iupFF7C1YCoaJqq4UOWQIBBmtTuIQmWWxekJQeYWuWcFYPfl+dLAELOxML2hIYDeEWt7flEufknTZB7+8NBeyINxjqDwU4QYg26BTu6KVTEQEAOw==">
<link href="https://fonts.googleapis.com/css2?family=Inter&display=swap" rel="stylesheet">
<style>
:root {
--color: black;
--title-color: black;
--background-color: white;
--link-color: #08F;
--link-hover-color: #F40;
--selector-text-color: black;
--selector-active-text-color: black;
--selector-background-color: #EEE;
--selector-active-background-color: #FFCB80;
--selector-hover-text-color: black;
--selector-hover-background-color: #FDB;
--summary-every-other-row-color: #F8F8F8;
--highlight-color: #EEE;
--bar-color: #FFCB80;
--tooltip-text-color: white;
--tooltip-background-color: black;
--nothing-selected-color: #CCC;
--shadow-color: grey;
}
[data-theme="dark"] {
--color: #CCC;
--title-color: white;
--background-color: #04293A;
--link-color: #8CF;
--link-hover-color: #FFF;
--selector-text-color: white;
--selector-background-color: #444;
--selector-active-text-color: white;
--selector-active-background-color: #088;
--selector-hover-text-color: black;
--selector-hover-background-color: white;
--summary-every-other-row-color: #042e41;
--highlight-color: #064663;
--bar-color: #088;
--tooltip-text-color: white;
--tooltip-background-color: #444;
--nothing-selected-color: #666;
--shadow-color: black;
}
html, body {
color: var(--color);
background-color: var(--background-color);
width: 100%;
height: 100%;
margin: 0;
overflow: auto;
box-sizing: border-box;
}
body {
font-family: 'Inter', sans-serif;
padding: 1% 3% 0 3%;
}
h1 {
color: var(--title-color);
}
table {
border-spacing: 1px;
}
.stick-left {
position: sticky;
left: 0px;
}
.selectors-container {
padding: 2rem 0 2rem 0;
user-select: none;
}
.selectors-container th {
text-align: left;
vertical-align: top;
white-space: nowrap;
padding-top: 0.5rem;
padding-right: 1rem;
}
.selector {
display: inline-block;
margin-left: 0.1rem;
padding: 0.2rem 0.5rem 0.2rem 0.5rem;
background: var(--selector-background-color);
color: var(--selector-text-color);
border: 0.2rem solid var(--background-color);
border-radius: 0.5rem;
}
.selector-active {
color: var(--selector-active-text-color);
background: var(--selector-active-background-color);
}
a, a:visited {
text-decoration: none;
color: var(--link-color);
cursor: pointer;
}
a:hover {
color: var(--link-hover-color);
}
.selector:hover {
color: var(--selector-hover-text-color) !important;
background: var(--selector-background-color);
}
.selector-active:hover {
background: var(--selector-hover-background-color);
}
#summary tr:nth-child(odd) {
background: var(--summary-every-other-row-color);
}
.summary-name {
white-space: nowrap;
text-align: right;
padding-right: 1rem;
}
.summary-bar-cell {
width: 100%;
}
.summary-bar {
height: 1rem;
background: var(--bar-color);
border-radius: 0 0.2rem 0.2rem 0;
}
.summary-number {
font-family: monospace;
text-align: right;
padding-left: 1rem;
white-space: nowrap;
}
th {
padding-bottom: 0.5rem;
}
.th-entry-hilite {
background: var(--highlight-color);
font-weight: bold;
}
.summary-row:hover, .summary-row-hilite {
background: var(--highlight-color) !important;
font-weight: bold;
}
#details {
padding-bottom: 1rem;
}
#details th {
vertical-align: bottom;
white-space: pre;
}
#details td {
white-space: pre;
font-family: monospace;
text-align: right;
padding: 0.1rem 0.5rem 0.1rem 0.5rem;
}
.shadow:hover {
box-shadow: 0 0 1rem var(--shadow-color);
position: relative;
}
#nothing-selected {
display: none;
font-size: 32pt;
font-weight: bold;
color: var(--nothing-selected-color);
}
.note {
position: relative;
display: inline-block;
}
.tooltip {
position: absolute;
bottom: calc(100% + 0.5rem);
visibility: hidden;
background-color: var(--tooltip-background-color);
color: var(--tooltip-text-color);
box-shadow: 0 0 1rem var(--shadow-color);
padding: 0.5rem 0.75rem;
border-radius: 0.5rem;
z-index: 1;
text-align: left;
white-space: normal;
}
.tooltip-result {
left: calc(50% - 0.25rem);
width: 20rem;
margin-left: -10rem;
}
.tooltip-query {
left: 0;
width: 40rem;
margin-left: -3rem;
}
.note:hover .tooltip {
visibility: visible;
}
.tooltip::after {
content: " ";
position: absolute;
top: 100%;
border-width: 0.5rem;
border-style: solid;
border-color: var(--tooltip-background-color) transparent transparent transparent;
}
.tooltip-result::after {
left: 50%;
margin-left: -1rem;
}
.tooltip-query::after {
left: 3rem;
margin-left: 0.5rem;
}
.nowrap {
text-wrap: none;
}
.themes {
float: right;
font-size: 200%;
cursor: pointer;
}
#toggle-dark, #toggle-light {
padding-right: 0.5rem;
cursor: pointer;
}
#toggle-dark:hover, #toggle-light:hover {
display: inline-block;
transform: translate(1px, 1px);
filter: brightness(125%);
}
</style>
<script type="text/javascript">
const queries = [
"SELECT version();",
"SELECT count(*) FROM url('https://shell.duckdb.org/data/tpch/0_01/parquet/lineitem.parquet');",
"SELECT toYYYYMMDD(tpep_pickup_datetime) as day, uniqHLL12(PULocationID) as locations, count(*) as trips, sum(fare_amount) + sum(mta_tax) + sum(tolls_amount) + sum(tip_amount) as revenue FROM url('https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2023-01.parquet') WHERE trip_distance > 5 GROUP BY toYYYYMMDD(tpep_pickup_datetime) ORDER BY day;",
"SELECT UserID, SearchPhrase, COUNT(*) FROM 'https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_0.parquet' GROUP BY UserID, SearchPhrase LIMIT 10;",
"SELECT SUM(ResolutionWidth), SUM(ResolutionWidth + 1), SUM(ResolutionWidth + 2), SUM(ResolutionWidth + 3), SUM(ResolutionWidth + 4), SUM(ResolutionWidth + 5), SUM(ResolutionWidth + 6), SUM(ResolutionWidth + 7), SUM(ResolutionWidth + 8), SUM(ResolutionWidth + 9), SUM(ResolutionWidth + 10), SUM(ResolutionWidth + 11), SUM(ResolutionWidth + 12), SUM(ResolutionWidth + 13), SUM(ResolutionWidth + 14), SUM(ResolutionWidth + 15), SUM(ResolutionWidth + 16), SUM(ResolutionWidth + 17), SUM(ResolutionWidth + 18), SUM(ResolutionWidth + 19), SUM(ResolutionWidth + 20), SUM(ResolutionWidth + 21), SUM(ResolutionWidth + 22), SUM(ResolutionWidth + 23), SUM(ResolutionWidth + 24), SUM(ResolutionWidth + 25), SUM(ResolutionWidth + 26), SUM(ResolutionWidth + 27), SUM(ResolutionWidth + 28), SUM(ResolutionWidth + 29), SUM(ResolutionWidth + 30), SUM(ResolutionWidth + 31), SUM(ResolutionWidth + 32), SUM(ResolutionWidth + 33), SUM(ResolutionWidth + 34), SUM(ResolutionWidth + 35), SUM(ResolutionWidth + 36), SUM(ResolutionWidth + 37), SUM(ResolutionWidth + 38), SUM(ResolutionWidth + 39), SUM(ResolutionWidth + 40), SUM(ResolutionWidth + 41), SUM(ResolutionWidth + 42), SUM(ResolutionWidth + 43), SUM(ResolutionWidth + 44), SUM(ResolutionWidth + 45), SUM(ResolutionWidth + 46), SUM(ResolutionWidth + 47), SUM(ResolutionWidth + 48), SUM(ResolutionWidth + 49), SUM(ResolutionWidth + 50), SUM(ResolutionWidth + 51), SUM(ResolutionWidth + 52), SUM(ResolutionWidth + 53), SUM(ResolutionWidth + 54), SUM(ResolutionWidth + 55), SUM(ResolutionWidth + 56), SUM(ResolutionWidth + 57), SUM(ResolutionWidth + 58), SUM(ResolutionWidth + 59), SUM(ResolutionWidth + 60), SUM(ResolutionWidth + 61), SUM(ResolutionWidth + 62), SUM(ResolutionWidth + 63), SUM(ResolutionWidth + 64), SUM(ResolutionWidth + 65), SUM(ResolutionWidth + 66), SUM(ResolutionWidth + 67), SUM(ResolutionWidth + 68), SUM(ResolutionWidth + 69), SUM(ResolutionWidth + 70), SUM(ResolutionWidth + 71), SUM(ResolutionWidth + 72), SUM(ResolutionWidth + 73), SUM(ResolutionWidth + 74), SUM(ResolutionWidth + 75), SUM(ResolutionWidth + 76), SUM(ResolutionWidth + 77), SUM(ResolutionWidth + 78), SUM(ResolutionWidth + 79), SUM(ResolutionWidth + 80), SUM(ResolutionWidth + 81), SUM(ResolutionWidth + 82), SUM(ResolutionWidth + 83), SUM(ResolutionWidth + 84), SUM(ResolutionWidth + 85), SUM(ResolutionWidth + 86), SUM(ResolutionWidth + 87), SUM(ResolutionWidth + 88), SUM(ResolutionWidth + 89) FROM url('https://datasets.clickhouse.com/hits_compatible/athena_partitioned/hits_0.parquet');"
];
const data = [
{"system":"chdb","date":"2023-11-15","machine":"github_runner 2vCPU_7GB","cluster_size":"serverless","comment":"23.10.1.1","tags":["C++","column-oriented","ClickHouse derivative","embedded","github"],"load_time":0,"data_size":0,"result":[[0.020692370999995546,0.019195821000010937,0.02035425399998303],[0.2784577150000018,0.06409655900000644,0.0715281839999875],[0.45289739000000395,0.4583085239999889,0.4524349579999978],[0.2459518830000036,0.18749831999997468,0.1797837230000141],[0.20213648800000783,0.19559821499998975,0.1585320859999797]],"source":"chdb/results/github_runner.2vCPU_7GB.json"}
,{"system":"databend","date":"2023-11-15","machine":"github_runner 2vCPU_7GB","cluster_size":"serverless","comment":"latest","tags":["C++","column-oriented","ClickHouse derivative","embedded","github"],"load_time":0,"data_size":0,"result":[[0.02690260699998248,0.0009032209999872975,0.0008003770000186705],[0.1738068040000087,0.10818057100001965,0.11298169599999142],[2.577246625000015,1.4592669160000185,1.5341862440000114],[0.4320807889999969,0.34962742800001934,0.3451583679999999],[0.37698491999998396,0.3271687459999839,0.34575885399999606]],"source":"databend/results/github_runner.2vCPU_7GB.json"}
,{"system":"DuckDB","date":"2023-11-15","machine":"github_runner 2vCPU_7GB","cluster_size":"serverless","comment":"0.9.2","tags":["C++","column-oriented","embedded","github"],"load_time":0,"data_size":0,"result":[[0.0007359720000295056,0.00025521600002775813,0.0005053429999861692],[0.6586982750000061,0.17197968900001115,0.1626433839999777],[0.6492984160000219,0.5097620329999586,0.49884921900002155],[0.41624013799997783,0.304018745999997,0.29378503999998884],[0.4032462600000031,0.3467112480000196,0.32655438500000855]],"source":"duckdb/results/github_runner.2vCPU_7GB.json"}
,{"system":"glaredb","date":"2023-11-15","machine":"github_runner 2vCPU_7GB","cluster_size":"serverless","comment":"latest","tags":["C++","column-oriented","ClickHouse derivative","embedded","github"],"load_time":0,"data_size":0,"result":[[0.009075598000038099,0.0031476030000021638,0.0030726150000077723],[0.390560899000036,0.10927754399995138,0.13690133700004026],[0.757771412000011,0.6527556350000054,0.6785934769999926],[0.35879993999998305,0.35297438399999237,0.2945536149999839],[0.31882334800002354,0.32992239199995765,0.34424676000003274]],"source":"glaredb/results/github_runner.2vCPU_7GB.json"}
]; // end of data
const additional_data_size_points = [
];
</script>
</head>
<body>
<div class="header stick-left">
<span class="nowrap themes"><span id="toggle-dark">🌚</span><span id="toggle-light">🌞</span></span>
<h1>CloudBench: a Benchmark for Embedded OLAP Engines</h1>
Embedded OLAP query engines + Remote Cloud parquets only, no local files. Based on <a href="https://benchmark.clickhouse.com/" target="_blank">ClickBench</a><br>
Benchmarks powered by free <a href="https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#cloud-hosts-used-by-github-hosted-runners" _target="_blank">GitHub Action Runners</a>
</div>
<table class="selectors-container stick-left">
<tr>
<th>System: </th>
<td id="selectors_system">
<a id="select-all-systems" class="selector selector-active">All</a>
</td>
</tr>
<tr>
<th>Type: </th>
<td id="selectors_type">
<a id="select-all-types" class="selector selector-active">All</a>
</td>
</tr>
<tr>
<th>Machine: </th>
<td id="selectors_machine">
<a id="select-all-machines" class="selector selector-active">All</a>
</td>
</tr>
<tr>
<th>Cluster size: </th>
<td id="selectors_cluster_size">
<a id="select-all-cluster-sizes" class="selector selector-active">All</a>
</td>
</tr>
<tr>
<th>Metric: </th>
<td id="selectors_run">
<a class="selector" id="selector-metric-cold">Cold Run</a>
<a class="selector" id="selector-metric-hot">Hot Run</a>
<a class="selector" id="selector-metric-load">Load Time</a>
<a class="selector" id="selector-metric-size">Storage Size</a>
</td>
</tr>
</table>
<table class="stick-left comparison">
<thead>
<tr>
<th class="summary-name">
System & Machine
</th>
<th colspan="2">
Relative <span id="time-or-size">time</span> (lower is better)
</th>
</tr>
</thead>
<tbody id="summary">
</tbody>
</table>
<div id="nothing-selected" class="stick-left">Nothing selected</div>
<div class="stick-left comparison">
<h2>Detailed Comparison</h2>
</div>
<table id="details">
<thead>
<tr id="details_head">
</tr>
</thead>
<tbody id="details_body">
</tbody>
</table>
<script type="text/javascript">
const constant_time_add = 0.01;
const missing_result_penalty = 2;
const missing_result_time = 300;
let selectors = {
"system": {},
"type": {},
"machine": {},
"cluster_size": {},
"metric": "hot",
"queries": [],
};
let theme = 'light';
function setTheme(new_theme) {
theme = new_theme;
document.documentElement.setAttribute('data-theme', theme);
window.localStorage.setItem('theme', theme);
render();
}
document.getElementById('toggle-light').addEventListener('click', e => setTheme('light'));
document.getElementById('toggle-dark').addEventListener('click', e => setTheme('dark'));
let new_theme = window.localStorage.getItem('theme');
if (new_theme && new_theme != theme) {
setTheme(new_theme);
}
/// Generate selectors
let systems = document.getElementById('selectors_system');
let types = document.getElementById('selectors_type');
let machines = document.getElementById('selectors_machine');
let cluster_sizes = document.getElementById('selectors_cluster_size');
let unique_systems = [... new Set(data.map(elem => elem.system))];
function toggle(e, elem, selectors_map) {
selectors_map[elem] = !selectors_map[elem];
e.target.className = selectors_map[elem] ? 'selector selector-active' : 'selector';
render();
updateHistory();
}
function toggleAll(e, selectors_map) {
const new_value = Object.keys(selectors_map).filter(k => selectors_map[k]).length * 2 < Object.keys(selectors_map).length;
[...e.target.parentElement.querySelectorAll('a')].map(
elem => { elem.className = new_value ? 'selector selector-active' : 'selector' });
Object.keys(selectors_map).map(k => { selectors_map[k] = new_value });
render();
updateHistory();
}
unique_systems.map(elem => {
let selector = document.createElement('a');
selector.className = 'selector selector-active';
selector.appendChild(document.createTextNode(elem));
systems.appendChild(selector);
if (!(elem in selectors.system)) { selectors.system[elem] = data.some(entry => entry.system == elem && !entry.hide); }
selector.addEventListener('click', e => toggle(e, elem, selectors.system));
/// Highlighting summary rows and table columns on hovering over the system selector.
selector.addEventListener('mouseover', e => {
[...document.querySelectorAll('.summary-row')].map(row => {
row.className = row.dataset.system == elem ? 'summary-row summary-row-hilite' : 'summary-row' });
[...document.querySelectorAll('.th-entry')].map(th => {
th.className = th.dataset.system == elem ? 'th-entry th-entry-hilite' : 'th-entry' });
});
selector.addEventListener('mouseout', e => {
[...document.querySelectorAll('.summary-row')].map(row => { row.className = 'summary-row' });
[...document.querySelectorAll('.th-entry')].map(row => { row.className = 'th-entry' });
});
});
[... new Set(data.map(elem => elem.tags).flat())].map(elem => {
let selector = document.createElement('a');
selector.className = 'selector selector-active';
selector.appendChild(document.createTextNode(elem));
types.appendChild(selector);
if (!(elem in selectors.type)) { selectors.type[elem] = true; }
selector.addEventListener('click', e => toggle(e, elem, selectors.type));
});
[... new Set(data.map(elem => elem.machine))].map(elem => {
let selector = document.createElement('a');
selector.className = 'selector selector-active';
selector.appendChild(document.createTextNode(elem));
machines.appendChild(selector);
if (!(elem in selectors.machine)) { selectors.machine[elem] = true; }
selector.addEventListener('click', e => toggle(e, elem, selectors.machine));
});
[... new Set(data.map(elem => elem.cluster_size))].sort(
(a, b) => ((typeof(b) === 'number') - (typeof(a) === 'number')) || (a - b)).map(elem => {
let selector = document.createElement('a');
selector.className = 'selector selector-active';
selector.appendChild(document.createTextNode(elem));
cluster_sizes.appendChild(selector);
if (!(elem in selectors.cluster_size)) { selectors.cluster_size[elem] = true; }
selector.addEventListener('click', e => toggle(e, elem, selectors.cluster_size));
});
document.getElementById('select-all-systems').addEventListener('click', e => toggleAll(e, selectors.system));
document.getElementById('select-all-types').addEventListener('click', e => toggleAll(e, selectors.type));
document.getElementById('select-all-machines').addEventListener('click', e => toggleAll(e, selectors.machine));
document.getElementById('select-all-cluster-sizes').addEventListener('click', e => toggleAll(e, selectors.cluster_size));
[...document.getElementById('selectors_run').querySelectorAll('a')].map(elem => elem.addEventListener('click', e => {
[...e.target.parentElement.querySelectorAll('a')].map(elem => { elem.className = elem == e.target ? 'selector selector-active' : 'selector' });
}));
document.getElementById('selector-metric-cold').addEventListener('click', e => { selectors.metric = 'cold'; render(); updateHistory(); });
document.getElementById('selector-metric-hot').addEventListener('click', e => { selectors.metric = 'hot'; render(); updateHistory(); });
document.getElementById('selector-metric-load').addEventListener('click', e => { selectors.metric = 'load'; render(); updateHistory(); });
document.getElementById('selector-metric-size').addEventListener('click', e => { selectors.metric = 'size'; render(); updateHistory(); });
selectors.queries = [...data[0].result.keys()].map(k => true);
function updateSelectors() {
[...systems.childNodes].map(elem => { elem.className = selectors.system[elem.innerText] ? 'selector selector-active' : 'selector' });
[...types.childNodes].map(elem => { elem.className = selectors.type[elem.innerText] ? 'selector selector-active' : 'selector' });
[...machines.childNodes].map(elem => { elem.className = selectors.machine[elem.innerText] ? 'selector selector-active' : 'selector' });
[...cluster_sizes.childNodes].map(elem => { elem.className = selectors.cluster_size[elem.innerText] ? 'selector selector-active' : 'selector' });
[...document.getElementById('selectors_run').querySelectorAll('a')].map(elem => {
elem.className = elem.id == 'selector-metric-' + selectors.metric ? 'selector selector-active' : 'selector' });
[...document.querySelectorAll('.query-checkbox')].map((elem, i) => { elem.checked = selectors.queries[i] });
}
function clearElement(elem)
{
while (elem.firstChild) {
elem.removeChild(elem.lastChild);
}
}
function selectRun(timings) {
return selectors.metric == 'cold' ? timings[0] : (timings[1] !== null && timings[2] !== null ? Math.min(timings[1], timings[2]) : null)
}
function addNote(text) {
let note = document.createElement('sup');
note.className = 'note';
note.appendChild(document.createTextNode('†'));
let tooltip = document.createElement('span');
tooltip.className = 'tooltip tooltip-result';
tooltip.appendChild(document.createTextNode(text));
note.appendChild(tooltip);
return note;
}
function renderSummary(filtered_data) {
let table = document.getElementById('summary');
clearElement(table);
/// Generate summary
/// The algorithm: for each of the queries,
/// - if there is a result - take query duration, add 10 ms, and divide it to the corresponding value from the baseline,
/// - if there is no result - take the worse query duration across all query runs for this system and multiply by 2.
/// Take geometric mean across the queries.
let summary = {};
const num_queries = filtered_data[0].result.length;
const baseline_data = [...filtered_data[0].result.keys()].map(query_num =>
[...Array(3).keys()].map(run_num =>
Math.min(...filtered_data.filter(elem => !elem.fake).map(elem => elem.result[query_num][run_num]).filter(x => x))));
const min_load_time = Math.min(...filtered_data.map(elem => elem.load_time).filter(x => x));
const min_data_size = Math.min(...filtered_data.map(elem => elem.data_size).filter(x => x));
let summaries;
if (selectors.metric == 'load') {
summaries = filtered_data.map(elem => elem.load_time / min_load_time);
document.getElementById('time-or-size').innerText = 'time';
} else if (selectors.metric == 'size') {
summaries = filtered_data.map(elem => elem.data_size / min_data_size);
document.getElementById('time-or-size').innerText = 'size';
} else {
summaries = filtered_data.map(elem => {
const fallback_timing = missing_result_penalty * Math.max(missing_result_time, ...elem.result.map(timings => selectRun(timings)));
let accumulator = 0;
let used_queries = 0;
const no_queries_selected = selectors.queries.filter(x => x).length == 0;
for (let i = 0; i < num_queries; ++i) {
if (no_queries_selected || selectors.queries[i]) {
const curr_timing = selectRun(elem.result[i]) ?? fallback_timing;
const baseline_timing = selectRun(baseline_data[i]);
const ratio = (constant_time_add + curr_timing) / (constant_time_add + baseline_timing);
accumulator += Math.log(ratio);
++used_queries;
}
}
return Math.exp(accumulator / used_queries);
});
document.getElementById('time-or-size').innerText = 'time';
}
const sorted_indices = [...summaries.keys()].sort((a, b) => summaries[a] - summaries[b]);
const max_ratio = summaries[sorted_indices[sorted_indices.length - 1]];
sorted_indices.map(idx => {
const elem = filtered_data[idx];
if (selectors.metric == 'size' && elem.data_size === null) { return; }
let tr = document.createElement('tr');
tr.className = 'summary-row';
tr.dataset.system = elem.system;
let td_name = document.createElement('td');
td_name.className = 'summary-name';
if (!elem.fake) {
let link = document.createElement('a');
link.appendChild(document.createTextNode(`${elem.system} (${Number.isInteger(elem.cluster_size) && elem.cluster_size > 1 ? elem.cluster_size + '×': ''}${elem.machine})`));
link.href = "https://github.com/ClickHouse/ClickBench/blob/main/" + elem.source;
td_name.appendChild(link);
} else {
td_name.appendChild(document.createTextNode(elem.system));
}
if (elem.comment) { td_name.appendChild(addNote(elem.comment)); }
td_name.appendChild(document.createTextNode(': '));
const ratio = summaries[idx];
const percentage = summaries[idx] / max_ratio * 100;
let td_number = document.createElement('td');
td_number.className = 'summary-number';
const text = selectors.metric == 'load' ? (elem.load_time ? `${Math.round(elem.load_time)}s (×${ratio.toFixed(2)})` : 'stateless')
: selectors.metric == 'size' ? `${(elem.data_size / 1024 / 1024 / 1024).toFixed(2)} GiB (×${ratio.toFixed(2)})`
: `×${ratio.toFixed(2)}`;
td_number.appendChild(document.createTextNode(text));
let td_bar = document.createElement('td');
td_bar.className = 'summary-bar-cell';
let bar = document.createElement('div');
bar.className = `summary-bar`;
bar.style.width = `${percentage}%`;
td_bar.appendChild(bar);
tr.appendChild(td_name);
tr.appendChild(td_bar);
tr.appendChild(td_number);
table.appendChild(tr);
});
return [sorted_indices, baseline_data];
}
function colorize(elem, ratio) {
let [r, g, b] = [0, 0, 0];
/// ratio less than 1 - green
/// ratio from 1 to 2 - green to yellow
/// ratio from 2 to 10 - yellow to red
/// ratio from 10 to 1000 to infinity - red to brown to black
/// Note: we are using RGB space without proper gamma correction. Read more: https://www.handprint.com/HP/WCL/color1.html
if (ratio !== null) {
if (ratio < 1) {
r = 232;
g = 255;
b = 232;
} else if (ratio <= 1) {
g = 255;
} else if (ratio <= 2) {
g = 255;
r = (ratio - 1) * 255;
} else if (ratio <= 10) {
g = (10 - ratio) / 8 * 255;
r = 255;
} else {
r = (1 - ((ratio - 10) / ((ratio - 10) + 1000))) * 255;
}
}
if (document.documentElement.getAttribute('data-theme') == 'dark') {
r /= 1.5;
g /= 1.5;
b /= 1.5;
}
elem.style.backgroundColor = `rgb(${r}, ${g}, ${b})`;
if (ratio === null || ratio > 10) {
/// This will look better on dark backgrounds
elem.style.color = 'white';
} else {
elem.style.color = 'black';
}
/// The best result is highlighted
if (ratio == 1) {
elem.style.fontWeight = 'bold';
}
}
function render() {
let details_head = document.getElementById('details_head');
let details_body = document.getElementById('details_body');
clearElement(details_head);
clearElement(details_body);
let filtered_data = data.filter(elem =>
selectors.system[elem.system] &&
selectors.machine[elem.machine] &&
selectors.cluster_size[elem.cluster_size] &&
elem.tags.filter(type => selectors.type[type]).length > 0);
let nothing_selected_elem = document.getElementById('nothing-selected');
if (filtered_data.length == 0) {
nothing_selected_elem.style.display = 'block';
[...document.querySelectorAll('.comparison')].map(e => e.style.display = 'none');
return;
}
nothing_selected_elem.style.display = 'none';
[...document.querySelectorAll('.comparison')].map(e => e.style.display = 'block');
if (selectors.metric == 'size') {
filtered_data = [...filtered_data, ...additional_data_size_points];
}
let [sorted_indices, baseline_data] = renderSummary(filtered_data);
sorted_indices = sorted_indices.filter(idx => !filtered_data[idx].fake);
/// Generate details
/// Global checkbox
{
let th_checkbox = document.createElement('th');
let checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.checked = true;
checkbox.addEventListener('change', e => {
[...document.querySelectorAll('.query-checkbox')].map(elem => { elem.checked = e.target.checked });
selectors.queries.map((_, i) => { selectors.queries[i] = e.target.checked });
renderSummary(filtered_data);
updateHistory();
});
th_checkbox.appendChild(checkbox);
details_head.appendChild(th_checkbox);
details_head.appendChild(document.createElement('th'));
}
/// Table header
sorted_indices.map(idx => {
const elem = filtered_data[idx];
let th = document.createElement('th');
th.appendChild(document.createTextNode(`${elem.system}\n(${Number.isInteger(elem.cluster_size) && elem.cluster_size > 1 ? elem.cluster_size + '×': ''}${elem.machine})`));
th.className = 'th-entry';
th.dataset.system = elem.system;
details_head.appendChild(th);
});
/// Load times
{
let tr = document.createElement('tr');
tr.className = 'shadow';
let td_title = document.createElement('td');
td_title.colSpan = 2;
td_title.appendChild(document.createTextNode('Load time: '));
tr.appendChild(td_title);
sorted_indices.map(idx => {
const curr_timing = filtered_data[idx].load_time;
const baseline_timing = Math.min(...filtered_data.map(elem => elem.load_time).filter(x => x));
const ratio = curr_timing / baseline_timing;
let td = document.createElement('td');
td.appendChild(document.createTextNode(curr_timing ? `${Math.round(curr_timing)}s (×${ratio.toFixed(2)})` : '0'));
colorize(td, ratio);
tr.appendChild(td);
});
details_body.appendChild(tr);
}
/// Data sizes
{
let tr = document.createElement('tr');
tr.className = 'shadow';
let td_title = document.createElement('td');
td_title.colSpan = 2;
td_title.appendChild(document.createTextNode('Data size: '));
tr.appendChild(td_title);
sorted_indices.map(idx => {
const curr_size = filtered_data[idx].data_size;
const baseline_size = Math.min(...filtered_data.map(elem => elem.data_size).filter(x => x));
const ratio = curr_size !== null ? curr_size / baseline_size : null;
let td = document.createElement('td');
td.appendChild(document.createTextNode(curr_size !== null ? `${(curr_size / 1024 / 1024 / 1024).toFixed(2)} GiB (×${ratio.toFixed(2)})` : '☠'));
colorize(td, ratio);
tr.appendChild(td);
});
details_body.appendChild(tr);
}
/// Query runtimes
const num_queries = filtered_data[0].result.length;
for (let query_num = 0; query_num < num_queries; ++query_num) {
let tr = document.createElement('tr');
tr.className = 'shadow';
let td_checkbox = document.createElement('td');
let checkbox = document.createElement('input');
checkbox.type = 'checkbox';
checkbox.className = 'query-checkbox';
checkbox.checked = selectors.queries[query_num];
checkbox.addEventListener('change', e => {
selectors.queries[query_num] = e.target.checked;
renderSummary(filtered_data);
updateHistory();
});
td_checkbox.appendChild(checkbox);
tr.appendChild(td_checkbox);
let td_query_num = document.createElement('td');
td_query_num.className = 'note';
td_query_num.appendChild(document.createTextNode(`Q${query_num}. `));
let tooltip = document.createElement('span');
tooltip.className = 'tooltip tooltip-query';
tooltip.appendChild(document.createTextNode(`Query ${query_num}: ${queries[query_num]}`));
td_query_num.appendChild(tooltip);
tr.appendChild(td_query_num);
sorted_indices.map(idx => {
const curr_timing = selectRun(filtered_data[idx].result[query_num]);
const baseline_timing = selectRun(baseline_data[query_num]);
const ratio = curr_timing !== null ? (constant_time_add + curr_timing) / (constant_time_add + baseline_timing) : null;
let td = document.createElement('td');
td.appendChild(document.createTextNode(curr_timing !== null ? `${curr_timing.toFixed(2)}s (×${ratio.toFixed(2)})` : '☠'));
colorize(td, ratio);
tr.appendChild(td);
});
details_body.appendChild(tr);
}
}
function updateHistory() {
history.pushState(selectors, '',
window.location.pathname + (window.location.search || '') + '#' + btoa(JSON.stringify(selectors)));
}
window.onpopstate = function(event) {
if (!event.state) { return; }
selectors = event.state;
render();
updateSelectors();
};
if (window.location.hash) {
try {
selectors = JSON.parse(atob(window.location.hash.substring(1)));
} catch {}
}
render();
updateSelectors();
</script>
</body>
</html>