Skip to content

Commit

Permalink
Revamp tig-benchmarker
Browse files Browse the repository at this point in the history
  • Loading branch information
FiveMovesAhead committed May 12, 2024
1 parent d1d3e47 commit b784547
Show file tree
Hide file tree
Showing 14 changed files with 996 additions and 899 deletions.
13 changes: 13 additions & 0 deletions tig-benchmarker/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# TIG Browser Benchmarker

This browser benchmarker is deployed to https://play.tig.foundation/benchmarker

To run it locally, run the following commands before visiting localhost in your browser:

```
# uncomment below to install wasm-pack
# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
cd tig-benchmarker
wasm-pack build --release --target web
python3 -m http.server 80
```
20 changes: 20 additions & 0 deletions tig-benchmarker/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>TIG Benchmarker Test</title>
</head>
<body>
<h1>TIG Browser Benchmarker</h1>
<h2>Instructions:</h2>
<ol>
<li>Open the browser console</li>
<li>Setup: `await benchmarker.setup(&lt;api_url&gt;, &lt;api_key&gt;, &lt;player_id&gt;)`</li>
<li>Start: `await benchmarker.start(&lt;num_workers&gt;)`</li>
<li>Stop: `await benchmarker.stop()`</li>
<li>Select Algorithm: `await benchmarker.select_algorithm(&lt;challenge_id>, &lt;algorithm_id&gt;)`</li>
<li>View State: `await benchmarker.state()`</li>
</ol>
<script type="module" src="./index.js"></script>
</body>
</html>
12 changes: 12 additions & 0 deletions tig-benchmarker/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import init, { setup, state, start, stop, select_algorithm } from './pkg/tig_benchmarker.js';

async function loadWasm() {
console.log("Loading Benchmarker WASM");
await init("./pkg/tig_benchmarker_bg.wasm");
window.benchmarker = {
setup, state, start, stop, select_algorithm
};
console.log("Benchmarker WASM initialized and functions are available globally");
}

loadWasm();
Loading

0 comments on commit b784547

Please sign in to comment.