aboutsummaryrefslogtreecommitdiff
path: root/web/js/main.mjs
diff options
context:
space:
mode:
authorjae beller <foss@jae.zone>2025-03-29 23:38:12 -0400
committerGitHub <noreply@github.com>2025-03-29 23:38:12 -0400
commit5237291072c19a8f07b47162b7a9a86a1d1a21b2 (patch)
treedd8d0eb724dbc4e642cc9ca79ab83c33b7fd1b35 /web/js/main.mjs
parent0f41388bd78668ceae6d5c12b05868bd0ca8fd1f (diff)
downloadanubis-5237291072c19a8f07b47162b7a9a86a1d1a21b2.tar.xz
anubis-5237291072c19a8f07b47162b7a9a86a1d1a21b2.zip
Debug tool for benchmarking proof-of-work algorithms (#155)
* cmd/anubis: add a debug option for benchmarking hashrate Having the ability to benchmark different proof-of-work implementations is useful for extending Anubis. This adds a flag `--debug-benchmark-js` (and its associated environment variable `DEBUG_BENCHMARK_JS`) for serving a tool to do so. Internally, a there is a new policy action, "DEBUG_BENCHMARK", which serves the benchmarking tool instead of a challenge. The flag then replaces all bot rules with a special rule matching every request to that action. The benchmark page makes heavy use of inline styles, because currently all global styles are shared across all pages. This could be fixed, but I wanted to avoid major changes to the templates. * web/js: add signal for aborting an active proof-of-work algorithm Both proof-of-work algorithms now take an optional `AbortSignal`, which immediately terminates all workers and returns `false` if aborted before the challenge is complete. * web/js: add algorithm comparison to the benchmark page "Compare:" is added to the benchmark page for testing the relative performance between two algorithms. Since benchmark runs generally have high variance, it may take a while for the averages to converge on a stable difference. --------- Signed-off-by: Xe Iaso <me@xeiaso.net> Co-authored-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'web/js/main.mjs')
-rw-r--r--web/js/main.mjs1
1 files changed, 1 insertions, 0 deletions
diff --git a/web/js/main.mjs b/web/js/main.mjs
index 01f21f0..3203e4a 100644
--- a/web/js/main.mjs
+++ b/web/js/main.mjs
@@ -127,6 +127,7 @@ const dependencies = [
const { hash, nonce } = await process(
challenge,
rules.difficulty,
+ null,
(iters) => {
const delta = Date.now() - t0;
// only update the speed every second so it's less visually distracting