6292f12A benchmark chapter, and offline benchmarks to compare it againstJeremy Magland 1# Offline benchmarks
3The benchmark chapter of the tutorial runs its four methods in the browser
4through numbl. The scripts here run the two best of those methods, the
5harmonic basis and the graded-panel double layer, outside the browser, on the
6same Pac-Man problem, the same error lattice, and the same timing protocol
7(solve only, warmed up, minimum over repeats when a solve is under 5 ms).
9Run whichever of these your machine has, from the repository root:
11```
12python3 bench/python/bench_pacman.py # needs NumPy
13julia bench/julia/bench_pacman.jl # standard library only
14matlab -batch "run('bench/matlab/bench_pacman.m')"
15```
17Each writes a `bench-pacman-*.json` file (the MATLAB one lands in the
18repository root, the others in the current directory). Load those files from
19the "load offline results" button under the benchmark chapter's
20work-precision plot, and they appear as dashed curves beside the browser's.
22The point of running the scripts yourself, rather than reading times measured
23on someone else's machine, is that your browser results and your offline
24results then share a clock and can honestly share an axis.
26The MATLAB harness runs the chapter's own driver and editable script,
27unchanged, in real MATLAB. The Python and Julia scripts are ports; the check
28that they are faithful is that their error columns land on top of the
29browser's curves, since the error depends only on the mathematics. All three
30were verified to reproduce the browser's errors to plotting accuracy.
32## The file format
34```json
35{
36 "schema": "laplace-dirichlet-bench-1",
37 "label": "what the legend should call this run",
38 "kind": "both",
39 "date": "2026-08-20",
40 "methods": [
41 {
42 "name": "harmonic basis, least squares",
43 "slot": "mps",
44 "ns": [4, 8, 16],
45 "E": [8.1e-4, 6.3e-6, 3.6e-10],
46 "T": [0.2, 0.4, 0.9]
47 }
48 ]
49}
50```
52`slot` picks the plot colour and marker and is one of `fd2`, `fd4`,
53`spectral`, `fast`, `iterative`, `mps`, `bie`; anything else falls back to
54`fd2`. `E` is the maximum absolute error over the chapter's fixed interior
55lattice, `T` the solve time in milliseconds, and entries may be `null` for a
56resolution a method skipped. `kind` records which ground truth was measured
57(`both`, `sing`, or `smooth`); the page warns if it differs from the one the
58lab is currently showing. Nothing stops you from writing a file in this
59format from any other language or machine; the legend will say whatever
60`label` says.