diff --git a/docs/.vitepress/theme/components/Benchmark.vue b/docs/.vitepress/theme/components/Benchmark.vue index 443c791..d7c1a4d 100644 --- a/docs/.vitepress/theme/components/Benchmark.vue +++ b/docs/.vitepress/theme/components/Benchmark.vue @@ -19,6 +19,12 @@ const doBenchmark = async (i, total) => { const Cap = window.Cap; + try { + plausible("benchmark", { + props: { difficulty, challenges, challengeSize, workers, benchmarks }, + }); + } catch {} + try { window.CAP_CUSTOM_FETCH = async (url, options) => { if (url === "/api/challenge") { @@ -27,18 +33,14 @@ const doBenchmark = async (i, total) => { JSON.stringify({ challenge: Array.from({ length: challenges.value }, () => [ Array.from( - browserCrypto.getRandomValues( - new Uint8Array(Math.ceil(challengeSize.value / 2)) - ) + browserCrypto.getRandomValues(new Uint8Array(Math.ceil(challengeSize.value / 2))) ) .map((byte) => byte.toString(16).padStart(2, "0")) .join("") .slice(0, challengeSize.value), Array.from( - browserCrypto.getRandomValues( - new Uint8Array(Math.ceil(difficulty.value / 2)) - ) + browserCrypto.getRandomValues(new Uint8Array(Math.ceil(difficulty.value / 2))) ) .map((byte) => byte.toString(16).padStart(2, "0")) .join("") @@ -95,9 +97,7 @@ const doBenchmark = async (i, total) => { progressValue.value = (i / total) * 100; - resultMessage.value = `Benchmark ${i}/${total} completed in ${Math.round( - time - )} ms.`; + resultMessage.value = `Benchmark ${i}/${total} completed in ${Math.round(time)} ms.`; return time; } catch (error) { console.error(`Benchmark ${i}/${total} failed:`, error); @@ -138,10 +138,7 @@ async function runBenchmark() {