Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
1865 lines (1577 loc) · 73.5 KB
/
Copy pathindex.html
File metadata and controls
1865 lines (1577 loc) · 73.5 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
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
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JSONBench — a Benchmark For Data Analytics On JSON</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="icon" type="image/png" href="favicon.png">
<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;
--hashed-link-lightness: 0.5;
--selector-text-color: black;
--selector-active-text-color: black;
--selector-background-color: #EEE;
--selector-active-background-color: #FFCB80;
--selector-passive-background-color: #EEDDCC;
--selector-hover-text-color: black;
--selector-hover-background-color: #FDB;
--summary-every-other-row-color: #F8F8F8;
--highlight-color: #EEE;
--tag-hilite-color: #FF88AA;
--bar-color1: oklch(calc(0.9 - 0.6) 0.1 calc(90 - 60));
--bar-color2: oklch(calc(0.9 - 0.4) 0.1 calc(90 - 40));
--bar-color3: oklch(calc(0.9 - 0.1) 0.1 calc(90 - 20));
--bar-color4: oklch(0.9 0.1 90);
/* The reference sizes of the raw files of the dataset, in the Storage Size metric. */
--fake-bar-color1: #999;
--fake-bar-color2: #BBB;
--fake-bar-color3: #DDD;
--fake-bar-color4: #EEE;
--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;
--hashed-link-lightness: 0.82;
--selector-text-color: white;
--selector-background-color: #444;
--selector-active-text-color: white;
--selector-active-background-color: #088;
--selector-passive-background-color: #566;
--selector-hover-text-color: black;
--selector-hover-background-color: white;
--summary-every-other-row-color: #042e41;
--highlight-color: #000;
--tag-hilite-color: #CC6600;
--bar-color1: oklch(calc(0.4 + 0.6) 0.1 calc(250 - 180));
--bar-color2: oklch(calc(0.4 + 0.4) 0.1 calc(250 - 120));
--bar-color3: oklch(calc(0.4 + 0.2) 0.1 calc(250 - 60));
--bar-color4: oklch(0.4 0.1 250);
--fake-bar-color1: #888;
--fake-bar-color2: #666;
--fake-bar-color3: #555;
--fake-bar-color4: #444;
--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);
}
.title-row {
display: flex;
align-items: center;
gap: 0.75rem;
flex-wrap: wrap;
}
.github-stars {
display: inline-flex;
align-items: center;
gap: 0.4em;
font-size: 0.95rem;
line-height: 1;
text-decoration: none;
color: inherit;
border: 1px solid rgba(127, 127, 127, 0.4);
border-radius: 6px;
padding: 0.4em 0.7em;
background: rgba(127, 127, 127, 0.08);
white-space: nowrap;
transition: background 0.15s;
}
.github-stars:hover {
background: rgba(127, 127, 127, 0.18);
}
.github-stars-icon {
width: 1.1em;
height: 1.1em;
fill: currentColor;
}
.github-stars-count {
font-weight: 600;
}
.description {
margin: 0 0 0.75rem 0;
}
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;
}
.inline-filter {
display: inline-block;
margin-right: 1.5rem;
white-space: nowrap;
}
.inline-filter-label {
font-weight: bold;
margin-right: 0.25rem;
}
.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);
}
.selector-passive {
color: var(--selector-active-text-color);
background: var(--selector-passive-background-color);
}
.selector-tag-hilite {
background: var(--tag-hilite-color) !important;
}
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, .selector-passive: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;
position: relative;
}
.summary-bar-cell {
width: 100%;
position: relative;
}
.summary-date {
position: absolute;
right: 0.5rem;
top: 0;
bottom: 0;
display: flex;
align-items: center;
font-size: 80%;
text-stroke: 2px var(--background-color);
-webkit-text-stroke: 2px var(--background-color);
paint-order: stroke fill;
pointer-events: none;
font-family: monospace;
}
.summary-bar {
height: 1rem;
width: 100%;
}
.summary-bar-fake {
--bar-color1: var(--fake-bar-color1);
--bar-color2: var(--fake-bar-color2);
--bar-color3: var(--fake-bar-color3);
--bar-color4: var(--fake-bar-color4);
}
/* A system that failed at the selected size, but worked at a smaller one. */
.summary-bar-failed {
background: black;
}
.summary-row-failed .summary-number {
font-family: inherit;
font-size: 1.5rem;
line-height: 1rem;
}
.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;
}
.remove-system {
visibility: hidden;
cursor: pointer;
color: var(--link-color);
user-select: none;
position: absolute;
left: -1rem;
padding-right: 1.5rem;
}
.summary-row:hover .remove-system {
visibility: visible;
}
.remove-system:hover {
color: var(--link-hover-color);
}
#details {
padding-bottom: 1rem;
}
#details th {
vertical-align: bottom;
white-space: pre;
}
#details.details-fixed {
table-layout: fixed;
}
#details .details-spacer {
padding: 0;
}
#details td {
white-space: pre;
font-family: monospace;
text-align: right;
padding: 0.1rem 0.5rem 0.1rem 0.5rem;
}
/* The query checkbox and number stay put while the table is scrolled
horizontally, so it is always clear which query a row belongs to.
The outline covers the table's 1px border-spacing and the
pseudo-element covers the body padding left of the table — without
them the cells scrolling underneath shine through around it. */
#details .details-query {
position: sticky;
left: 0;
z-index: 1;
background-color: var(--background-color);
outline: 1px solid var(--background-color);
}
#details .details-query::before {
content: '';
position: absolute;
top: -1px;
bottom: -1px;
right: 100%;
width: 100vw;
background-color: var(--background-color);
}
.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;
font-weight: normal;
}
.tooltip-result {
left: calc(50% - 0.25rem);
width: 20rem;
margin-left: -10rem;
}
.tooltip-query {
left: 0;
width: 40rem;
}
/* The tooltips of the selectors open to the right, not to be cut by the left edge of the page. */
.tooltip-selector {
left: -0.5rem;
width: 30rem;
}
.note:hover .tooltip, .note:active .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, .tooltip-selector::after {
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%);
}
#scale_hint {
font-weight: normal;
font-size: 80%;
filter: contrast(10%);
}
</style>
<script type="text/javascript" src="data.generated.js"></script>
<script type="text/javascript">
/// The queries in the ClickHouse dialect, see clickhouse/queries.sql. Every system runs their equivalents.
const queries = [
"SELECT data.commit.collection AS event, count() AS count FROM bluesky GROUP BY event ORDER BY count DESC;",
"SELECT data.commit.collection AS event, count() AS count, uniqExact(data.did) AS users FROM bluesky WHERE data.kind = 'commit' AND data.commit.operation = 'create' GROUP BY event ORDER BY count DESC;",
"SELECT data.commit.collection AS event, toHour(fromUnixTimestamp64Micro(data.time_us)) as hour_of_day, count() AS count FROM bluesky WHERE data.kind = 'commit' AND data.commit.operation = 'create' AND data.commit.collection in ['app.bsky.feed.post', 'app.bsky.feed.repost', 'app.bsky.feed.like'] GROUP BY event, hour_of_day ORDER BY hour_of_day, event;",
"SELECT data.did::String as user_id, min(fromUnixTimestamp64Micro(data.time_us)) as first_post_ts FROM bluesky WHERE data.kind = 'commit' AND data.commit.operation = 'create' AND data.commit.collection = 'app.bsky.feed.post' GROUP BY user_id ORDER BY first_post_ts ASC LIMIT 3;",
"SELECT data.did::String as user_id, date_diff( 'milliseconds', min(fromUnixTimestamp64Micro(data.time_us)), max(fromUnixTimestamp64Micro(data.time_us))) AS activity_span FROM bluesky WHERE data.kind = 'commit' AND data.commit.operation = 'create' AND data.commit.collection = 'app.bsky.feed.post' GROUP BY user_id ORDER BY activity_span DESC LIMIT 3;",
];
</script>
</head>
<body>
<div class="header stick-left">
<span class="nowrap themes"><span id="toggle-dark">🌚</span><span id="toggle-light">🌞</span></span>
<div class="title-row">
<h1>JSONBench — a Benchmark For Data Analytics On JSON</h1>
<a class="github-stars" href="https://github.com/ClickHouse/ClickBench/" target="_blank" rel="noopener noreferrer" aria-label="Star ClickBench on GitHub" title="Star ClickBench on GitHub">
<svg class="github-stars-icon" viewBox="0 0 16 16" aria-hidden="true"><path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Z"/></svg>
<span>Star</span>
<span class="github-stars-count" id="github-stars-count"></span>
</a>
</div>
<p class="description">The native JSON support of analytical databases, on a dataset of up to 1 billion JSON documents of Bluesky events.</p>
<a href="https://github.com/ClickHouse/ClickBench/tree/main/json">Methodology</a> | <a href="https://clickhouse.com/blog/json-bench-clickhouse-vs-mongodb-elasticsearch-duckdb-postgresql">Blog Post</a> | <a href="https://github.com/ClickHouse/ClickBench/tree/main/json">Reproduce and Validate the Results</a> | <a href="https://github.com/ClickHouse/ClickBench/tree/main/json">Add a New Database</a> | <a href="https://github.com/ClickHouse/ClickBench/issues">Report Mistake</a> | See also: <a href="https://benchmark.clickhouse.com/">ClickBench</a> | <a href="https://benchmark.clickhouse.com/hardware/">Hardware Benchmark</a> | <a href="https://benchmark.clickhouse.com/versions/">Versions Benchmark</a> | <a href="https://benchmark.clickhouse.com/playground/">🎈 Playground</a>
</div>
<table class="selectors-container stick-left">
<tr>
<td colspan="2">
<span class="inline-filter" id="selectors_opensource">
<span class="inline-filter-label">Open source:</span>
<a id="selector-opensource-yes" class="selector selector-active">Yes</a>
<a id="selector-opensource-no" class="selector selector-active">No</a>
</span>
<span class="inline-filter" id="selectors_flattening">
<span class="inline-filter-label note">Flattening<sup>†</sup><span class="tooltip tooltip-selector">Some databases provide a native JSON data type that flattens nested JSON documents at insertion time to a single level, which removes the possibility to restore the original documents. We consider this a grey zone, and generally discourage it: the systems with flattening are hidden by default.</span>:</span>
<a id="selector-flattening-no" class="selector selector-active">No</a>
<a id="selector-flattening-yes" class="selector">Yes</a>
</span>
</td>
</tr>
<tr>
<th>Scale: </th>
<td id="selectors_scale">
</td>
</tr>
<tr>
<th>System: </th>
<td id="selectors_system">
<a id="select-all-systems" class="selector selector-active">All</a>
</td>
</tr>
<tr id="selectors-type-row">
<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>Metric: </th>
<td id="selectors_run">
<a class="selector" id="selector-metric-combined">Combined</a>
<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>
<a class="selector" id="selector-metric-quality">Data Quality</a>
<a class="selector" id="selector-metric-complexity">Complexity</a>
</td>
</tr>
</table>
<table id="summary-table" class="stick-left comparison">
<thead>
<tr>
<th class="summary-name">
System & Machine
</th>
<th colspan="2">
<span id="metric-title"></span><br/>
<span id="scale_hint"></span>
</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;
/// Some systems take hours for a query on the largest dataset, hence the minimum penalty is larger than in ClickBench.
const missing_result_time = 3600;
/// The reference sizes of the raw files of the dataset (data.json, data.json.gz, ...) are shown only
/// in the Storage Size metric, regardless of the selectors, as they are not results of a system.
/// Entries with `error` are the failed latest runs of a system on a dataset size (see
/// collect-new-results.sh): they have no results, and are only shown as failed, below the chart.
const real_data = data.filter(elem => !elem.fake && !elem.error);
const fake_data = data.filter(elem => elem.fake);
const failed_data = data.filter(elem => elem.error);
let selectors = {
"system": {},
"type": {},
"machine": {},
"opensource": {"yes": true, "no": true},
/// Whether a system flattens the JSON documents, which is the opposite of the `retains_structure` field.
"flattening": {"no": true, "yes": false},
/// The number of the documents in the dataset, single-select.
"scale": "1000000000",
"metric": "combined",
"queries": queries.map(() => true),
};
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) {
theme = new_theme;
document.documentElement.setAttribute('data-theme', theme);
}
/// Generate selectors
let scales = document.getElementById('selectors_scale');
let systems = document.getElementById('selectors_system');
let types = document.getElementById('selectors_type');
let machines = document.getElementById('selectors_machine');
let unique_systems = [... new Set(real_data.map(elem => elem.system))].sort((a, b) => a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}));
const system_to_tags = {};
real_data.forEach(d => {
if (!system_to_tags[d.system]) system_to_tags[d.system] = new Set();
(d.tags || []).forEach(t => system_to_tags[d.system].add(t));
});
function highlightSystemTags(systemName) {
const tags = system_to_tags[systemName] || new Set();
for (const elem of types.childNodes) {
if (elem.tagName !== 'A') continue;
if (tags.has(elem.textContent)) elem.classList.add('selector-tag-hilite');
}
}
function clearSystemTagsHighlight() {
for (const elem of types.childNodes) {
if (elem.tagName !== 'A') continue;
elem.classList.remove('selector-tag-hilite');
}
}
/// Highlighting summary rows and table columns of a system, together with its tags.
function highlightSystem(systemName) {
[...document.querySelectorAll('.summary-row')].map(row => {
row.classList.toggle('summary-row-hilite', row.dataset.system == systemName) });
[...document.querySelectorAll('.th-entry')].map(th => {
th.className = th.dataset.system == systemName ? 'th-entry th-entry-hilite' : 'th-entry' });
highlightSystemTags(systemName);
}
function clearSystemHighlight() {
[...document.querySelectorAll('.summary-row')].map(row => { row.classList.remove('summary-row-hilite') });
[...document.querySelectorAll('.th-entry')].map(th => { th.className = 'th-entry' });
clearSystemTagsHighlight();
}
/// A click flips a single toggle, while a right click or Ctrl/Cmd + click selects only this toggle in its group.
function toggle(e, elem, selectors_map) {
if (e.type == 'contextmenu' || e.ctrlKey || e.metaKey) {
e.preventDefault();
Object.keys(selectors_map).forEach(k => { selectors_map[k] = k == String(elem) });
} else {
selectors_map[elem] = !selectors_map[elem];
}
updateSelectors();
render();
updateHistory();
}
function addToggleListener(selector, elem, selectors_map) {
selector.addEventListener('click', e => toggle(e, elem, selectors_map));
selector.addEventListener('contextmenu', e => toggle(e, elem, selectors_map));
}
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();
}
function formatScale(dataset_size) {
return `${dataset_size / 1_000_000} million`;
}
[... new Set(real_data.map(elem => elem.dataset_size))].sort((a, b) => a - b).map(elem => {
let selector = document.createElement('a');
selector.className = 'selector';
selector.dataset.value = String(elem);
selector.appendChild(document.createTextNode(formatScale(elem)));
scales.appendChild(selector);
selector.addEventListener('click', e => {
selectors.scale = String(elem);
updateSelectors();
render();
updateHistory();
});
});
unique_systems.map(elem => {
let selector = document.createElement('a');
selector.className = 'selector selector-active';
selector.appendChild(document.createTextNode(elem));
systems.appendChild(selector);
selectors.system[elem] = real_data.some(entry => entry.system == elem && !entry.hide);
addToggleListener(selector, elem, selectors.system);
/// Highlighting summary rows and table columns on hovering over the system selector.
selector.addEventListener('mouseover', () => highlightSystem(elem));
selector.addEventListener('mouseout', clearSystemHighlight);
});
const tag_to_systems = {};
real_data.forEach(d => {
(d.tags || []).forEach(t => {
if (!tag_to_systems[t]) tag_to_systems[t] = new Set();
tag_to_systems[t].add(d.system);
});
});
const unique_tags = [... new Set(real_data.map(elem => elem.tags || []).flat())].sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
unique_tags.map(elem => {
let selector = document.createElement('a');
selector.className = 'selector selector-active';
selector.appendChild(document.createTextNode(elem));
types.appendChild(selector);
selectors.type[elem] = true;
addToggleListener(selector, elem, selectors.type);
/// Highlighting summary rows and detail columns on hovering over a tag.
selector.addEventListener('mouseover', () => {
const tagged = tag_to_systems[elem] || new Set();
[...document.querySelectorAll('.summary-row')].map(row => {
row.classList.toggle('summary-row-hilite', tagged.has(row.dataset.system)) });
[...document.querySelectorAll('.th-entry')].map(th => {
th.className = tagged.has(th.dataset.system) ? 'th-entry th-entry-hilite' : 'th-entry' });
});
selector.addEventListener('mouseout', () => {
[...document.querySelectorAll('.summary-row')].map(row => { row.classList.remove('summary-row-hilite') });
[...document.querySelectorAll('.th-entry')].map(th => { th.className = 'th-entry' });
});
});
/// The machine that json/run-benchmark.sh runs the benchmark on.
const default_machine = 'm6i.8xlarge';
[... new Set(real_data.map(elem => elem.machine))].sort((a, b) => {
const count_diff = real_data.filter(elem => elem.machine === b).length - real_data.filter(elem => elem.machine === a).length;
return count_diff == 0 ? a.localeCompare(b, undefined, {numeric: true, sensitivity: 'base'}) : count_diff;
}).map(elem => {
/// Only the machine of the benchmark is selected by default: the other machines are
/// from the results submitted for managed services (e.g. `Hologres: 32 CU`), not comparable.
const selected = elem == default_machine;
let selector = document.createElement('a');
selector.className = selected ? 'selector selector-active' : 'selector';
selector.appendChild(document.createTextNode(elem));
machines.appendChild(selector);
selectors.machine[elem] = selected;
addToggleListener(selector, elem, selectors.machine);
});
/// The selectors without any data are not shown: the tags and the `proprietary` field are not in the older results,
/// and the load time and the complexity are not known for all of them.
/// The results without tags are not filtered by the type, and without the `proprietary` field - by the license.
const has_tags = unique_tags.length > 0;
const has_license = real_data.some(elem => elem.proprietary !== undefined);
if (!has_tags) { document.getElementById('selectors-type-row').style.display = 'none'; }
if (!has_license) { document.getElementById('selectors_opensource').style.display = 'none'; }
if (!real_data.some(elem => !metricExcludes(elem, 'load'))) { document.getElementById('selector-metric-load').style.display = 'none'; }
if (!real_data.some(elem => !metricExcludes(elem, 'complexity'))) { document.getElementById('selector-metric-complexity').style.display = 'none'; }
addToggleListener(document.getElementById('selector-opensource-yes'), 'yes', selectors.opensource);
addToggleListener(document.getElementById('selector-opensource-no'), 'no', selectors.opensource);
addToggleListener(document.getElementById('selector-flattening-no'), 'no', selectors.flattening);
addToggleListener(document.getElementById('selector-flattening-yes'), 'yes', selectors.flattening);
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('selectors_run').querySelectorAll('a')].map(elem => elem.addEventListener('click', e => {
selectors.metric = elem.id.replace('selector-metric-', '');
updateSelectors();
render();
updateHistory();
}));
/// Keeps the hover highlighting of the element intact, and skips the "All" toggle.
function setSelectorActive(elem, active) {
if (elem.tagName !== 'A' || elem.id.startsWith('select-all-')) return;
elem.classList.remove('selector-passive');
elem.classList.toggle('selector-active', !!active);
}
function updateSelectors() {
[...scales.children].map(elem => { setSelectorActive(elem, elem.dataset.value == selectors.scale) });
[...systems.childNodes].map(elem => { setSelectorActive(elem, selectors.system[elem.textContent]) });
[...types.childNodes].map(elem => { setSelectorActive(elem, selectors.type[elem.textContent]) });
[...machines.childNodes].map(elem => { setSelectorActive(elem, selectors.machine[elem.textContent]) });
[...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] });
document.getElementById('selector-opensource-yes').className = selectors.opensource.yes ? 'selector selector-active' : 'selector';
document.getElementById('selector-opensource-no').className = selectors.opensource.no ? 'selector selector-active' : 'selector';
document.getElementById('selector-flattening-no').className = selectors.flattening.no ? 'selector selector-active' : 'selector';
document.getElementById('selector-flattening-yes').className = selectors.flattening.yes ? 'selector selector-active' : 'selector';
}
function matchesLicense(elem) {
return elem.proprietary === undefined
|| (selectors.opensource.yes && elem.proprietary === "no") || (selectors.opensource.no && elem.proprietary === "yes");
}
function matchesFlattening(elem) {
return (selectors.flattening.no && elem.retains_structure === "yes") || (selectors.flattening.yes && elem.retains_structure === "no");
}
function matchesType(elem) {
const tags = elem.tags || [];
return tags.length == 0 || tags.some(type => selectors.type[type]);
}
/// Hides the selectors of the systems, types and machines that have no results under the filters of the top rows.
function applyTopRowFilters() {
const matches = real_data.filter(elem =>
matchesLicense(elem) && matchesFlattening(elem) && String(elem.dataset_size) == selectors.scale);
function apply(container, getValues) {
const allowed = new Set(matches.flatMap(getValues).map(x => String(x)));
for (const elem of container.childNodes) {
if (elem.tagName !== 'A') continue;
if (elem.id && elem.id.startsWith('select-all-')) continue;
elem.style.display = allowed.has(elem.textContent) ? '' : 'none';
}
}
apply(systems, e => [e.system]);
apply(types, e => e.tags || []);
apply(machines, e => [e.machine]);
}
function findPassiveSelectors(filtered_data) {
function process(name, container) {
const filtered = new Set(filtered_data.map(elem => elem[name]).flat().map(x => String(x)));
for (let elem of container.childNodes) {
if (elem.tagName == 'A') {
if (elem.classList.contains('selector-active') && !filtered.has(elem.textContent)) {
elem.className = 'selector selector-passive';
} else if (elem.classList.contains('selector-passive') && filtered.has(elem.textContent)) {
elem.className = 'selector selector-active';
}
}
}
}
process('system', systems);
process('tags', types);
process('machine', machines);
}
function clearElement(elem)
{
while (elem.firstChild) {
elem.removeChild(elem.lastChild);
}
}
/// The weights of the metrics in the Combined metric: the weighted geometric mean of the relative values.
/// The weights of the metrics not applicable to a system are given to the rest, see renderSummary.
/// The result is divided by the share of the documents that were loaded (the data quality), as a
/// penalty: loading 800 million of 1000 million documents multiplies it by 1.25.
const combined_load_time_share = 0.1;
const combined_data_size_share = 0.1;
const combined_cold_share = 0.2;
const combined_hot_share = 0.6;
document.getElementById('selector-metric-combined').title =
`The weighted geometric mean of the relative values of the metrics: ${combined_hot_share * 100}% hot run, ${combined_cold_share * 100}% cold run, `
+ `${combined_data_size_share * 100}% storage size, ${combined_load_time_share * 100}% load time. `
+ `If the load time is not known for a system, its weight is given to the rest of the metrics. `
+ `The result is divided by the share of the documents that were loaded: e.g. ×1.25 for 800 million of 1000 million.`;
function selectRun(timings, metric) {
if (timings == null) return null;
const cold_timing = timings[0];
const hot_timing = (timings[1] !== null && timings[2] !== null ? Math.min(timings[1], timings[2]) : null);
return metric == 'cold' ? cold_timing : metric == 'hot' ? hot_timing :
(hot_timing !== null && cold_timing !== null ? (hot_timing * combined_hot_share + cold_timing * combined_cold_share) / (combined_hot_share + combined_cold_share) : null);
}
function relativeQueryTime(num_queries, baseline_data, elem, metric) {
const fallback_timing = missing_result_penalty * Math.max(missing_result_time, ...elem.result.map(timings => selectRun(timings, metric)));
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 baseline_timing = selectRun(baseline_data[i], metric);
/// Skip queries that fail on every filtered system - otherwise the
/// geometric mean collapses to 0 and no bars render.
if (baseline_timing === null || !isFinite(baseline_timing)) continue;
const curr_timing = selectRun(elem.result[i], metric) ?? fallback_timing;
const ratio = (constant_time_add + curr_timing) / (constant_time_add + baseline_timing);
accumulator += Math.log(ratio);
++used_queries;
}
}
return used_queries > 0 ? Math.exp(accumulator / used_queries) : null;
}
function addNote(text) {
let note = document.createElement('span');
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 nameToColor(str) {
let x = 0;
for (let i = 0; i < str.length; i++) {
x += str.charCodeAt(i);
x *= 0xff51afd7;
x ^= x >> 17;
}
return 60 + Math.abs(x % 240);
}
/// Whether a system is excluded from a given metric. Single source of truth
/// shared by the top-level metric filter (render) and the per-run baseline
/// used inside the Combined metric (renderSummary) so the two never drift.
function metricExcludes(elem, metric) {
const tags = elem.tags || [];
switch (metric) {
case 'size':
/// Can't rank a system that didn't report a storage size.
return !(elem.total_size > 0);
case 'load':
/// The load time is measured only in the newer results; stateless / in-memory engines don't persist data.
return !(elem.load_time > 0) || tags.includes('stateless') || tags.includes('in-memory');
case 'quality':
return !(elem.num_loaded_documents >= 0);
case 'complexity':
/// Systems without the install script (with a manual procedure) have no value, see generate-results.sh.
return !(elem.complexity > 0);
case 'cold':
/// True cold-cache reads only: in-memory engines have nothing to
/// read from storage, and lukewarm (no-cold) runs never flush engine caches.
return tags.includes('in-memory') || tags.includes('no-cold');
case 'combined':
/// Combined still scores lukewarm (no-cold) systems (with the cold component
/// dropped, see below), but in-memory engines are excluded.
return tags.includes('in-memory');
case 'hot':
default:
return false;
}
}
/// Complexity is the zstd-compressed size of the system's scripts, see generate-results.sh.
function formatComplexity(complexity) {
return complexity >= 10240 ? `${(complexity / 1024).toFixed(0)} KiB` : complexity >= 1024 ? `${(complexity / 1024).toFixed(1)} KiB` : `${complexity} B`;
}
function formatSize(bytes) {
return `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GiB`;
}
/// The share of the documents of the dataset that were loaded.
function loadedShare(elem) {
return elem.num_loaded_documents / elem.dataset_size;
}