|
292 | 292 |
|
293 | 293 | const queries = {{ queries | tojson }}; |
294 | 294 |
|
295 | | - const data = {{ results | tojson }}; |
| 295 | + const dataGzipBase64 = "{{ results_gzip_base64 }}"; |
| 296 | + let dataPlainText = ""; |
| 297 | + let data = []; |
| 298 | +
|
| 299 | + function base64ToBytes(encoded) { |
| 300 | + const binary = atob(encoded); |
| 301 | + const bytes = new Uint8Array(binary.length); |
| 302 | + for (let i = 0; i < binary.length; i++) { |
| 303 | + bytes[i] = binary.charCodeAt(i); |
| 304 | + } |
| 305 | + return bytes; |
| 306 | + } |
| 307 | +
|
| 308 | + async function gunzipBase64(encoded) { |
| 309 | + if (!("DecompressionStream" in globalThis)) { |
| 310 | + throw new Error("This browser does not support gzip decompression."); |
| 311 | + } |
| 312 | +
|
| 313 | + const stream = new Blob([base64ToBytes(encoded)]) |
| 314 | + .stream() |
| 315 | + .pipeThrough(new DecompressionStream("gzip")); |
| 316 | + return await new Response(stream).text(); |
| 317 | + } |
| 318 | +
|
| 319 | + async function loadData() { |
| 320 | + dataPlainText = await gunzipBase64(dataGzipBase64); |
| 321 | + data = JSON.parse(dataPlainText); |
| 322 | +
|
| 323 | + const download = document.getElementById("download-data"); |
| 324 | + if (download) { |
| 325 | + download.href = URL.createObjectURL( |
| 326 | + new Blob([dataPlainText], { type: "application/json" }) |
| 327 | + ); |
| 328 | + } |
| 329 | + } |
296 | 330 |
|
297 | 331 | const additional_data_size_points = [ |
298 | 332 | ]; |
|
306 | 340 | <h1>{{ title }}</h1> |
307 | 341 | <a href="https://github.com/ClickHouse/ClickBench/">Clickbench</a> | |
308 | 342 | <a href="https://benchmark.databend.com/clickbench/release/{{ dataset }}.html">Release Versions</a> | |
309 | | - <a href="{{ url }}">Changeset Detail</a> |
| 343 | + <a href="{{ url }}">Changeset Detail</a> | |
| 344 | + <a id="download-data" download="{{ dataset }}-data.json" href="">Download Plaintext Data</a> |
310 | 345 | </div> |
311 | 346 |
|
312 | 347 | <table class="selectors-container stick-left"> |
|
376 | 411 | </table> |
377 | 412 |
|
378 | 413 | <script type="text/javascript"> |
| 414 | + loadData().then(() => { |
379 | 415 |
|
380 | 416 | const constant_time_add = 0.01; |
381 | 417 | const missing_result_penalty = 2; |
|
935 | 971 |
|
936 | 972 | render(); |
937 | 973 | updateSelectors(); |
| 974 | + }).catch(error => { |
| 975 | + console.error("Failed to load benchmark data:", error); |
| 976 | + const message = document.getElementById('nothing-selected'); |
| 977 | + message.textContent = `Failed to load benchmark data: ${error.message}`; |
| 978 | + message.style.display = 'block'; |
| 979 | + [...document.querySelectorAll('.comparison')].map(e => e.style.display = 'none'); |
| 980 | + }); |
938 | 981 |
|
939 | 982 | </script> |
940 | 983 | </body> |
|
0 commit comments