Skip to main content

BENCH_JS

Constant BENCH_JS 

Source
const BENCH_JS: &str = "\"use strict\";\n\nfunction benchSelectRun(index) {\n  for (const el of document.querySelectorAll(\".run-view\")) {\n    el.hidden = el.dataset.run !== String(index);\n  }\n\n  const script = document.getElementById(`run-data-${index}`);\n  if (!script) {\n    return;\n  }\n\n  const data = parseJSON(script);\n  if (!data) {\n    return;\n  }\n\n  const commitLink = document.getElementById(\"commit-link\");\n  if (data.commitUrl && commitLink) {\n    commitLink.href = data.commitUrl;\n    commitLink.textContent = (data.commitUrl.split(\"/\").at(-1) ?? \"\").slice(\n      0,\n      8,\n    );\n  }\n\n  const mapping = {\n    dps: data.dps,\n    scalingEfficiency: data.scalingEfficiency,\n    scalingMarginal: data.scalingMarginal,\n    scalingMultiplier: data.scalingMultiplier,\n    scalingThroughput: data.scalingThroughput,\n    scatter: data.scatter,\n    throughput: data.throughput,\n  };\n\n  const views = document.querySelectorAll(`.run-view[data-run=\"${index}\"]`);\n  for (const view of views) {\n    for (const el of view.querySelectorAll(\"[data-chart]\")) {\n      const opts = mapping[el.dataset.chart];\n      if (opts) {\n        initChart(el, opts);\n      }\n    }\n  }\n}\n\n{\n  const select = document.getElementById(\"run-select\");\n  if (select) {\n    benchSelectRun(select.value);\n  }\n  initGlobalChart(\"historyChart\", \"history-data\");\n  initGlobalChart(\"dpsHistoryChart\", \"dps-history-data\");\n}\n";