Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Timeline and proof mode docs, benchmark result format, submit tool and benchmarks page skeleton

islandmedba55d8e1f343
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 067543ea..64d707d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,31 @@ All notable changes to SculptForge are listed here. The format follows
## [Unreleased]
+### Added
+- **Sculpt Timeline**: every stroke and operation is a tick on a strip along the bottom of the canvas. Drag the
+ scrubber to see the model at any point of the session, click a step to go there. Sculpting from an earlier
+ point no longer throws the later steps away: they stay as a branch (a lane above the track) you can switch
+ back to, with undo / redo working on the active branch as before. Right-click a stroke to re-tune its strength
+ (0 removes it, 2 doubles it) without redoing the strokes after it; where later strokes overlap it they keep
+ their own displacement on top (they aren't sculpted again; see the guide's Sculpt Timeline chapter). Seeking
+ reuses undo's per-stroke deltas, swaps runs of strokes at once with one normal / BVH / GPU update, and jumps
+ from full checkpoints every 16 steps (within 1 GB; fewer on huge meshes) for long seeks. Each SubTool keeps
+ its own timeline. Commands `timeline_info`, `timeline_seek`, `timeline_select`, `timeline_retune`,
+ `timeline_save`, `timeline_load`; UI test timeline.
+- **Save with project** (in the timeline's header) also writes the history beside the project as
+ `<name>.sfhist` (strokes, masks, polypaint, visibility, polygroups, branches, re-tuned strengths; a topology
+ change cuts it). Opening the project brings it back when the mesh matches. The project format is unchanged.
+- **Export timelapse**: the history rendered as a turntable video, the model building up stroke by stroke while
+ the camera goes once around it (1080p or 4K MP4, no captions; needs ffmpeg). Also
+ `sculptforge project.sfproj --timelapse out.mp4 [--size 3840x2160] [--timelapse-seconds 20]`.
+- **Proof mode** (**Help > Benchmark**, `sculptforge --benchmark`): a scripted 240 Hz pen stroke through the
+ same input handlers a real pen uses, with a 60 px and a 240 px brush and a turn of the view, on 5, 20 and 33
+ million triangle meshes (100 million when free memory allows). A live HUD shows fps, frame time p50 / p95 /
+ p99, how far the stroke trails the pointer (ms and px) and memory; the run is recorded to an MP4 with the HUD in
+ it and written as a JSON result with the processor, graphics card, memory, OS, version and commit.
+ `docs/benchmark.md` describes the format, `tools/benchmark/submit.py` checks results and adds them to
+ `website/benchmarks/results.json`, which the new benchmarks page lists.
+
## [0.9.7] - 2026-10-31
Speed first: big brushes on dense meshes take a third less time per frame, trail the pen by half as far and no
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08e3ff46..8cfb2123 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -509,6 +509,8 @@ if(SCULPTFORGE_BUILD_TESTS)
-- --cli ${SCULPTFORGE_CLI_RUNNER})
set_tests_properties(blender_addon PROPERTIES TIMEOUT 300)
endif()
+ # Proof mode results: the validator and website list tool (tools/benchmark/submit.py, docs/benchmark.md).
+ add_test(NAME benchmark_submit COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark/submit.py selftest)
add_test(NAME guide_site COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/tools/guide/build_site.py --check
--out ${CMAKE_CURRENT_BINARY_DIR}/guide-site)
endif()
diff --git a/docs/benchmark.md b/docs/benchmark.md
new file mode 100644
index 00000000..548ba6c6
--- /dev/null
+++ b/docs/benchmark.md
@@ -0,0 +1,96 @@
+# Proof mode results (`sculptforge-benchmark/1`)
+
+Proof mode (**Help > Benchmark**, `sculptforge --benchmark`; user guide: [Performance](guide/performance.md))
+measures how responsive sculpting is on a given computer and writes the result as one JSON file, next to an MP4
+of the run with the live numbers burned in. This page describes that file, how to submit one, and how the
+website's [benchmarks page](../website/benchmarks/index.html) lists them.
+
+## What is measured
+
+For each mesh size (default 5, 20 and 33 million triangles; 100 million when the free memory exceeds about
+150 bytes per triangle with a quarter to spare; other features can add sizes through `proofExtraSizes()` in
+`src/app/ProofMode.h`, e.g. a 300 million triangle micro-displaced mesh):
+
+1. A sphere with subdivision levels is built (`makeBenchSphere`, as `--bench` does) and framed.
+2. **stroke**: a figure eight across the model, three times round in `stroke_seconds`, with the Standard brush
+ at 60 px (X symmetry on, as the app starts). Pointer samples are generated at 240 Hz and passed to
+ `App::onMouseDown` / `onMouseMove` / `onMouseUp`, the handlers SDL's mouse and pen events call, once per
+ frame (the samples that arrived since the last frame, in order), so the dab queue, its time budget, the
+ undo step, the Sculpt Timeline and the renderer all run as when a person sculpts.
+3. **large brush stroke**: the same with a 240 px brush.
+4. **orbit**: the view turns once in 3 seconds.
+
+Per frame, at the moment the frame is handed to the display (just before `SDL_GL_SwapWindow`):
+
+- `frame_ms`: the time since the previous frame was handed over.
+- `lag_ms`: from the time of the pointer sample the newest drawn dab belongs to (the nearest sample to it) to
+ now. The display's scan-out and the compositor add to this on a real screen (about one refresh).
+- `lag_px`: the distance along the stroke path from that sample to the newest sample (where the pointer is).
+
+Vertical sync is off unless `settings.vsync` is true. Recording the video (`settings.video`) reads every frame
+back through pixel buffers and encodes on another thread; it costs about 1 to 2 ms per frame. The machine is not
+otherwise controlled: other programs running at the same time slow it down.
+
+## The file
+
+```json
+{
+ "schema": "sculptforge-benchmark/1",
+ "sculptforge": { "version": "0.9.7", "commit": "930f814" },
+ "date": "2026-11-01T05:46:51Z",
+ "hardware": {
+ "cpu": "Apple MacBook Pro (16-inch, M1 Pro, 2021)",
+ "logical_cores": 10,
+ "ram_gb": 30.9,
+ "os": "Arch Linux ARM (Linux 7.1.13-3-1-ARCH aarch64)",
+ "gpu": "Apple M1 Pro (G13S C0), OpenGL 4.6 (Core Profile) Mesa 26.1.8",
+ "framebuffer": [1920, 1080],
+ "ui_scale": 1
+ },
+ "settings": {
+ "vsync": false, "video": true, "pointer_hz": 240, "stroke_seconds": 6,
+ "input": "...", "lag": "..."
+ },
+ "runs": [
+ {
+ "label": "20M", "triangles": 20971520, "vertices": 10485762,
+ "build_seconds": 9.1, "ram_mb": 2410, "peak_ram_mb": 2702,
+ "phases": [
+ {
+ "name": "stroke", "brush_radius_px": 60, "seconds": 6.0, "frames": 512, "fps": 85.3,
+ "frame_ms": { "p50": 10.8, "p95": 19.0, "p99": 26.4, "max": 41.0, "mean": 11.7 },
+ "lag_ms": { "p50": 18.0, "p95": 35.0, "p99": 48.0, "max": 70.0, "mean": 20.1 },
+ "lag_px": { "p50": 12.0, "p95": 25.0, "p99": 33.0, "max": 48.0, "mean": 13.0 },
+ "dabs": 1530, "pointer_samples": 1440, "path_px": 4300, "pointer_speed_px_s": 716
+ },
+ { "name": "large brush stroke", "brush_radius_px": 240, "...": "..." },
+ { "name": "orbit", "seconds": 3.0, "frames": 600, "fps": 200.0, "frame_ms": { "...": "..." } }
+ ]
+ }
+ ],
+ "video": "sculptforge-benchmark-20261031-224651.mp4",
+ "notes": "only present when something went wrong or the run was stopped"
+}
+```
+
+Field notes:
+
+- `sculptforge.commit` is the commit the build was configured from (`unknown` for builds outside git).
+- `hardware.cpu` is the processor's name, or on ARM Linux the machine's model from the device tree.
+- `runs[].ram_mb` is the resident memory at the end of that size's phases, `peak_ram_mb` the most during them
+ (Linux; 0 elsewhere).
+- Percentile objects always have `p50`, `p95`, `p99`, `max` and `mean`, in milliseconds or pixels.
+- New fields may be added; readers should ignore fields they don't know. An incompatible change gets a new
+ `schema` value.
+
+## Submitting a result
+
+1. Run proof mode on a quiet machine (close other heavy programs) with a release build or an official package.
+2. Check the file: `python3 tools/benchmark/submit.py check mine.json` validates it and prints a summary.
+3. Add it to the list: `python3 tools/benchmark/submit.py add mine.json --name "Your name or handle"
+ [--video https://...]` appends a compact entry to `website/benchmarks/results.json`. Open a pull request with
+ that change, attach the full JSON (and a link to the video, e.g. uploaded to YouTube) in the description.
+ Results can also be attached to an issue for a maintainer to add.
+
+The benchmarks page (`website/benchmarks/index.html`) reads `results.json` and shows one row per mesh size and
+submission: frame time and lag percentiles per phase, hardware, version.
diff --git a/docs/guide/images/timeline-strip.jpg b/docs/guide/images/timeline-strip.jpg
new file mode 100644
index 00000000..f17836a0
Binary files /dev/null and b/docs/guide/images/timeline-strip.jpg differ
diff --git a/docs/guide/index.md b/docs/guide/index.md
index 6a712cab..b8cc4d8b 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -34,33 +34,34 @@ You can read it inside SculptForge (**Help > User Guide**, or <kbd>Shift</kbd>+<
16. [Facial shapes and live face](facial-shapes.md)
17. [Subdivision levels](subdivision-levels.md)
18. [Dynamic topology](dynamic-topology.md)
-19. [Moving, rotating and posing (Gizmo 3D)](gizmo.md)
-20. [Subdivide, remesh, decimate and LODs](geometry.md)
-21. [Quad retopology and detail projection](retopology.md)
+19. [Sculpt Timeline and timelapse](timeline.md)
+20. [Moving, rotating and posing (Gizmo 3D)](gizmo.md)
+21. [Subdivide, remesh, decimate and LODs](geometry.md)
+22. [Quad retopology and detail projection](retopology.md)
## AI and capture
-22. [Image and text to 3D](generate-3d.md)
-23. [Gaussian splats](splats.md)
-24. [Scan an object into a splat](scan-to-splat.md)
-25. [From scan to sculptable mesh](scan-to-sculptable.md)
-26. [Phone capture and AR](phone-capture.md)
+23. [Image and text to 3D](generate-3d.md)
+24. [Gaussian splats](splats.md)
+25. [Scan an object into a splat](scan-to-splat.md)
+26. [From scan to sculptable mesh](scan-to-sculptable.md)
+27. [Phone capture and AR](phone-capture.md)
## Files and pipelines
-27. [Baking normal and displacement maps](baking.md)
-28. [Exporting, Unreal and ZBrush](exporting.md)
-29. [Working with Blender](blender.md)
-30. [Projects, autosave and QuickSave](projects.md)
-31. [Scripting and automation](scripting.md)
-32. [SculptForge for studios](studios.md)
+28. [Baking normal and displacement maps](baking.md)
+29. [Exporting, Unreal and ZBrush](exporting.md)
+30. [Working with Blender](blender.md)
+31. [Projects, autosave and QuickSave](projects.md)
+32. [Scripting and automation](scripting.md)
+33. [SculptForge for studios](studios.md)
## Reference
-33. [Keyboard and mouse](shortcuts.md)
-34. [Performance and big meshes](performance.md)
-35. [Troubleshooting and FAQ](troubleshooting.md)
-36. [Glossary](glossary.md)
+34. [Keyboard and mouse](shortcuts.md)
+35. [Performance and big meshes](performance.md)
+36. [Troubleshooting and FAQ](troubleshooting.md)
+37. [Glossary](glossary.md)
## Getting help
diff --git a/docs/guide/performance.md b/docs/guide/performance.md
index 64dd27f9..5a523a57 100644
--- a/docs/guide/performance.md
+++ b/docs/guide/performance.md
@@ -78,6 +78,41 @@ many small triangles at once; it then spreads the work over several dabs. Undoin
connections, which takes about a tenth of a second per million triangles. `sculptforge --bench --bench-dyntopo`
measures it on your machine.
+## Proof mode: see it for yourself
+
+**Help > Benchmark** (or `sculptforge --benchmark`) shows how responsive sculpting is on your own computer,
+measured the way it feels rather than the way a developer measures it. For each size, 5, 20 and 33 million
+triangles (and 100 million when there is enough free memory), it builds a sphere with subdivision levels, then
+plays a scripted pen stroke into the same code your mouse and pen go through, 240 pointer samples a second: a
+figure eight with a 60-pixel brush, the same with a 240-pixel brush, then a turn of the view. It replaces the
+scene, so save your work first; <kbd>Esc</kbd> stops it.
+
+While it runs, a panel in the corner shows:
+
+- **fps** and the **frame time**: the median (p50), and the 95th and 99th percentile, the slow frames you
+ would notice as a hitch.
+- **Stroke trails pointer**: how far the stroke on screen is behind the pointer, in milliseconds (from the
+ pointer sample the newest drawn dab belongs to until that frame is handed to the display; the display's
+ own refresh comes on top) and in pixels along the path.
+- The memory SculptForge uses.
+
+Vertical sync is off during the run so frame times aren't capped at the display's rate (tick **Keep vertical
+sync on** to measure with it). At the end a table sums up each mesh and phase, and two files are written: a video
+of the run with the panel in it (needs [ffmpeg](https://ffmpeg.org/); recording costs a millisecond or two per
+frame) and a JSON file with the results, your processor, graphics card, memory, operating system and the
+SculptForge version and commit. In the app they go to the `benchmarks` folder in SculptForge's settings folder
+(**Open folder** in the results); from the command line, to the current folder:
+
+```
+sculptforge --benchmark --benchmark-sizes 5,20,33 --benchmark-out mine.json --benchmark-video mine.mp4
+```
+
+`--benchmark-no-video` skips the video, `--benchmark-vsync` keeps vertical sync on, `--benchmark-seconds 6`
+sets the length of each stroke, and `--size 1920x1080` the window (a tiling window manager may choose another
+size; the result records the one used). Share a result on the
+[benchmarks page](https://sculptforge.app/benchmarks/) as its
+[format description](https://github.com/islandmed/SculptForge/blob/main/docs/benchmark.md) explains.
+
## Measuring your own machine
`sculptforge --bench` builds a sphere at 4, 16 and 32 million triangles and measures every brush, undo,
diff --git a/docs/guide/timeline.md b/docs/guide/timeline.md
new file mode 100644
index 00000000..a6a18bbd
--- /dev/null
+++ b/docs/guide/timeline.md
@@ -0,0 +1,100 @@
+# Sculpt Timeline and timelapse
+
+Every stroke and operation you make is a step on the **Sculpt Timeline**, the strip along the bottom of the
+canvas. Drag its scrubber to see the model at any point of the session, click a step to go back there, and keep
+sculpting from it: the steps you had made after it are not thrown away as with a plain undo, they stay as a
+branch you can switch back to. You can change how strongly a past stroke shows without redoing the strokes
+after it, and render the whole history as a turntable timelapse video.
+
+![The Sculpt Timeline under the canvas: three strokes on the active branch, the scrubber at the last one, and the lane of an earlier continuation above the track](images/timeline-strip.jpg)
+
+## The strip
+
+Each step is a tick on the track: sculpt strokes in light grey, masks in blue, polypaint in pink, visibility
+and polygroups in green, and topology changes (dynamic topology, remeshing, Divide, SubTool changes) as tall
+teal ticks. The orange scrubber marks the state the canvas shows; the steps after it are dimmed. A dot above a
+tick marks a re-tuned stroke.
+
+- **Drag** along the track to scrub through the history: the model follows as you drag.
+- **Click** a tick to go to the state after that step.
+- **Point** at a tick for what the step was, how many vertices it changed and when.
+- **Right-click** a stroke to re-tune it (see below).
+- The header shows the step you are at, the number of branches and the step's name. **Save with project**
+ keeps the history with the project, the film icon exports a timelapse, and the arrow folds the strip into a
+ small **Timeline** tab (click the tab to open it again; **Sculpt Timeline** in the command palette, F3, does
+ the same).
+
+Undo and Redo (<kbd>Ctrl</kbd>+<kbd>Z</kbd>, <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Z</kbd>) move the scrubber one
+step, as before. Each SubTool keeps its own timeline, like its own undo history.
+
+## Branches: undo without losing anything
+
+Go back to an earlier step and sculpt: a new branch starts there. The steps you had made after that point stay
+in the history as a thin lane above the track, starting where the branch splits off. Click the lane to make
+that branch the active one again; the branch you leave becomes the lane. Nothing is lost by trying an idea and
+going back.
+
+## Re-tuning a past stroke
+
+Right-click a stroke on the track and drag **Strength**: 1 is the stroke as you made it, 0 removes it, 2 makes it
+twice as strong. The model updates at once and the strokes you made after it are kept.
+
+How it works: the change to that one stroke's displacement is added to the model as it is now. Where later
+strokes don't touch the area, the result is exactly what you would have had with the new strength. Where later
+strokes overlap it, they keep the displacement they made at the time, on top of the re-tuned stroke: they are
+not sculpted again. So a Smooth you did afterwards over the same spot won't smooth the stronger version, and a
+later Inflate keeps the direction it pushed in then. For most detail passes that is what you want; for a big
+change under a lot of later work, check the area afterwards.
+
+A stroke can't be re-tuned when a step after it replaced the mesh as a whole (dynamic topology, a remesh,
+Divide, a sculpt layer change): the menu says which step is in the way. Strokes made on a sculpt layer can't be
+re-tuned either.
+
+## Big meshes
+
+Scrubbing reuses what undo already keeps for each stroke, only the vertices it moved. A run of strokes is
+swapped in one go, with normals and the view updated once for the whole run, and every few steps the timeline
+keeps a full copy of the shape (a checkpoint) so a jump across the whole history replays only a few strokes
+from the nearest one. Measured on an Apple M1 Pro after 220 strokes (a third of them big, up to 4.4 million
+vertices each), while other heavy programs were running:
+
+| Mesh | One step of the scrubber | A jump across the history |
+|---|---|---|
+| 21 million triangles | 5 ms typical, 50 ms for the biggest strokes | about 0.4 to 0.5 s |
+| 33 million triangles | 5 to 14 ms typical, up to 170 ms for the biggest strokes | about 0.6 to 1 s |
+
+See also [Performance and big meshes](performance.md).
+
+The history uses memory: undo keeps up to 1 GB (the oldest steps go first, as before), the timeline up to 1.5 GB
+more for inactive branches and the extra copy of each stroke that makes fast seeking possible, and up to 1 GB of
+checkpoints (fewer, further apart, on very big models). With those limits a 21 million triangle model keeps
+about the last 100 strokes of the size above, a 33 million one about 70; small detail strokes cost far less.
+
+## Saving the history
+
+Tick **Save with project** in the strip's header and saving a project also writes its history beside it, as
+`name.sfhist` next to `name.sfproj`. Opening the project brings the timeline back, branches and re-tuned strengths
+included, as long as the project hasn't been changed elsewhere since. Sculpt strokes, masks, polypaint, visibility
+and polygroups are saved; a topology change (dynamic topology, remesh, Divide, sculpt layers) cuts the saved
+history there, keeping what came after it.
+
+## Timelapse video
+
+**Export timelapse** (the film icon in the strip, or **Export timelapse...** in the command palette) renders the
+history of the active SubTool, from the start to the step you are at, as a turntable video: the model builds up
+stroke by stroke while the camera goes once around it, with a short pause at the start and the end. Pick 1080p
+or 4K, the length, and where to save the MP4. There are no captions or interface in the video. It needs
+[ffmpeg](https://ffmpeg.org/) installed.
+
+From the command line, for a project saved with its history:
+
+```
+sculptforge creature.sfproj --timelapse creature.mp4 --size 3840x2160 --timelapse-seconds 20
+```
+
+## Scripting
+
+The timeline is scriptable: `timeline_info list=true` lists the steps (with their ids), `timeline_seek index=N`
+shows step N of the active branch, `timeline_select node=ID` switches to the branch through a step,
+`timeline_retune node=ID strength=0.5` re-tunes a stroke, and `timeline_save` / `timeline_load` write and read
+the `.sfhist` file.
diff --git a/src/app/ProofMode.cpp b/src/app/ProofMode.cpp
index d0dbadc0..af564e67 100644
--- a/src/app/ProofMode.cpp
+++ b/src/app/ProofMode.cpp
@@ -309,7 +309,7 @@ struct PhaseSpec {
struct PhaseResult {
std::string name;
float radiusPx = 0;
- double seconds = 0, pathPx = 0;
+ double seconds = 0, pathPx = 0, releaseMs = 0; // releaseMs: lifting the pen (the dabs still queued, the undo step)
size_t dabs = 0, samples = 0;
std::vector<double> frameMs, lagMs, lagPx;
};
@@ -609,7 +609,7 @@ void App::proofBeforeSwap(int fbW, int fbH) {
r.phases.push_back({});
r.phases.back().name = spec.name;
r.phases.back().radiusPx = spec.radiusPx;
- p.stageStart = now;
+ p.stageStart = p.lastFrame = nowSeconds(); // (not counting what the last phase's release cost)
p.samples.clear();
p.dabs.clear();
p.sent = 1;
@@ -735,7 +735,9 @@ void App::proofBeforeSwap(int fbW, int fbH) {
for (; p.sent < p.samples.size(); ++p.sent)
onMouseMove(p.samples[p.sent].p.x, p.samples[p.sent].p.y, 0.0f, 0.0f, false);
if (u >= 1.0) {
+ const double up = nowSeconds();
onMouseUp(); // places the dabs still waiting, ends the stroke (undo step, timeline)
+ ph.releaseMs = (nowSeconds() - up) * 1000.0;
p.pressed = false;
strokeProbe_ = nullptr;
ph.dabs = p.dabs.size();
@@ -825,6 +827,7 @@ void App::proofBeforeSwap(int fbW, int fbH) {
j.set("dabs", double(ph.dabs));
j.set("pointer_samples", double(ph.samples));
j.set("path_px", std::round(ph.pathPx));
+ j.set("release_ms", std::round(ph.releaseMs * 10) / 10);
j.set("pointer_speed_px_s", ph.seconds > 0 ? std::round(ph.pathPx / ph.seconds) : 0.0);
}
phases.push(j);
@@ -848,7 +851,8 @@ void App::proofBeforeSwap(int fbW, int fbH) {
const Percentiles f = percentiles(ph.frameMs), l = percentiles(ph.lagMs), lp = percentiles(ph.lagPx);
std::printf(" %-5s %-19s %6.1f fps frame p50 %5.1f p95 %5.1f p99 %5.1f ms", r.label.c_str(), ph.name.c_str(),
ph.seconds > 0 ? double(ph.frameMs.size()) / ph.seconds : 0.0, f.p50, f.p95, f.p99);
- if (ph.radiusPx > 0) std::printf(" trails %4.0f ms / %4.0f px (p95 %4.0f ms / %4.0f px)", l.p50, lp.p50, l.p95, lp.p95);
+ if (ph.radiusPx > 0)
+ std::printf(" trails %4.0f ms / %4.0f px (p95 %4.0f ms / %4.0f px), release %.0f ms", l.p50, lp.p50, l.p95, lp.p95, ph.releaseMs);
std::printf("\n");
}
std::printf("Result: %s%s%s\n", p.jsonPath.c_str(), p.video ? "\nVideo: " : "", p.video ? p.videoPath.c_str() : "");
diff --git a/tests/test_timeline.cpp b/tests/test_timeline.cpp
index 9ca39a8c..25b37191 100644
--- a/tests/test_timeline.cpp
+++ b/tests/test_timeline.cpp
@@ -27,8 +27,11 @@ void stroke(Document& d, glm::vec3 a, glm::vec3 b, float radius = 0.3f, int dabs
d.sculptor.beginStroke(d.mesh, brushName(t));
for (int i = 0; i < dabs; ++i) {
DabParams p;
- p.center = glm::normalize(glm::mix(a, b, dabs > 1 ? float(i) / float(dabs - 1) : 0.0f));
- p.viewDir = -p.center;
+ const glm::vec3 dir = glm::normalize(glm::mix(a, b, dabs > 1 ? float(i) / float(dabs - 1) : 0.0f));
+ p.center = dir;
+ p.viewDir = -dir;
+ // On the surface as it is now (earlier strokes may have moved it off the unit sphere), as the app picks.
+ if (RayHit hit; d.bvh.raycast(d.mesh, dir * 4.0f, -dir, hit)) p.center = hit.position;
p.radius = radius;
p.strength = 0.6f;
d.sculptor.dab(d.mesh, d.bvh, t, p, Symmetry{});
@@ -302,45 +305,97 @@ TEST(timeline_follows_the_undo_budget_and_clear) {
CHECK(t2->seek(d, 0));
}
-// Large meshes: seeking must stay interactive (SF_BENCH_LIMITS=1; the sizes follow SF_TIMELINE_MILLIONS, default 5).
+
+// Large meshes with a long history. Always runs small; SF_BENCH_LIMITS=1 runs SF_TIMELINE_MILLIONS (default 5)
+// with SF_TIMELINE_STROKES strokes (default 64; a third of them big) and checks the times. SF_TIMELINE_UNDO_GB
+// raises the undo and timeline budgets (default: the app's 1 GiB undo, 1.5 GiB timeline extras) to keep them all.
TEST(timeline_seek_large_mesh_timing) {
const bool limits = benchLimits();
- double millions = 0.3;
- if (limits) millions = std::getenv("SF_TIMELINE_MILLIONS") ? std::atof(std::getenv("SF_TIMELINE_MILLIONS")) : 5.0;
+ auto env = [](const char* k, double fallback) { return std::getenv(k) ? std::atof(std::getenv(k)) : fallback; };
+ const double millions = limits ? env("SF_TIMELINE_MILLIONS", 5.0) : 0.3;
+ const int strokes = limits ? int(env("SF_TIMELINE_STROKES", 64)) : 12;
+ using C = std::chrono::steady_clock;
+ auto ms = [](C::time_point a) { return std::chrono::duration<double, std::milli>(C::now() - a).count(); };
+ const size_t rss0 = residentBytes();
+ auto c0 = C::now();
Document d = makeDoc(makeBenchSphere(size_t(millions * 1e6)));
+ const double buildMs = ms(c0);
auto t = Timeline::attach(d);
- const int strokes = limits ? 64 : 12;
+ if (const double gb = env("SF_TIMELINE_UNDO_GB", 0.0); gb > 0) {
+ d.undo.byteBudget = size_t(gb * double(1u << 30));
+ t->branchBudget = size_t(gb * double(1u << 30));
+ }
+ const size_t rssMesh = residentBytes();
std::mt19937 rng(3);
- using C = std::chrono::steady_clock;
+ double strokeMs = 0.0, syncMs = 0.0;
+ size_t touchedSum = 0, touchedMax = 0;
for (int i = 0; i < strokes; ++i) {
- stroke(d, randomDir(rng), randomDir(rng), 0.35f, 6);
+ const bool big = i % 3 == 2; // every third stroke a big one (a sixth of the sphere and more)
+ const glm::vec3 a = randomDir(rng);
+ const glm::vec3 b = glm::normalize(a + randomDir(rng) * (big ? 0.9f : 0.35f));
+ c0 = C::now();
+ const size_t before = d.undo.undoCount();
+ stroke(d, a, b, big ? 0.45f : 0.12f, big ? 8 : 10);
+ if (std::getenv("SF_TIMELINE_DEBUG") && d.undo.undoCount() == before)
+ std::printf(" stroke %d (%s) changed nothing: a %.2f %.2f %.2f b %.2f %.2f %.2f\n", i, big ? "big" : "small", a.x, a.y, a.z, b.x, b.y, b.z);
+ strokeMs += ms(c0);
+ c0 = C::now();
t->sync(d);
+ syncMs += ms(c0);
+ touchedSum += t->node(t->cursorNode()).touched;
+ touchedMax = std::max<size_t>(touchedMax, t->node(t->cursorNode()).touched);
}
+ const size_t last = t->path().size() - 1; // the undo budget may have dropped the oldest strokes
const std::vector<glm::vec3> end = d.mesh.positions;
- double worstStep = 0.0, full = 0.0, back = 0.0;
- auto c0 = C::now();
+ // Scrubbing one step at a time back over the last 40 steps, as dragging the scrubber slowly does.
+ std::vector<double> stepMs;
+ for (size_t i = last; i > 0 && i + 40 > last; --i) {
+ c0 = C::now();
+ CHECK(t->seek(d, i - 1));
+ stepMs.push_back(ms(c0));
+ }
+ // Long jumps: to the start, to the end, and between random points (a fast drag or a click).
+ c0 = C::now();
CHECK(t->seek(d, 0));
- full = std::chrono::duration<double, std::milli>(C::now() - c0).count();
- const size_t last = t->path().size() - 1; // (the undo budget may have dropped the oldest strokes)
+ const double toStart = ms(c0);
+ const bool startCk = t->lastSeek().usedCheckpoint;
c0 = C::now();
CHECK(t->seek(d, last));
- back = std::chrono::duration<double, std::milli>(C::now() - c0).count();
+ const double toEnd = ms(c0);
+ const bool endCk = t->lastSeek().usedCheckpoint;
CHECK(maxDiff(d.mesh.positions, end) == 0.0f);
- size_t touched = 0;
- for (size_t i = last; i > last - 8; --i) { // scrubbing one step at a time
- touched = std::max<size_t>(touched, t->node(t->path()[i]).touched);
+ std::vector<double> jumpMs;
+ int jumpsCk = 0;
+ std::uniform_int_distribution<size_t> pick(0, last);
+ for (int k = 0; k < 20; ++k) {
+ const size_t to = pick(rng);
c0 = C::now();
- CHECK(t->seek(d, i - 1));
- worstStep = std::max(worstStep, std::chrono::duration<double, std::milli>(C::now() - c0).count());
+ CHECK(t->seek(d, to));
+ jumpMs.push_back(ms(c0));
+ jumpsCk += t->lastSeek().usedCheckpoint;
}
- std::printf(" timeline %.1fM tris, %d strokes: seek to start %.1f ms, to end %.1f ms (%s), one step worst %.1f ms (strokes of up to %zu vertices), "
- "checkpoints %zu (%zu MiB), extras %zu MiB\n",
- double(d.mesh.triangleCount()) / 1e6, strokes, full, back,
- t->lastSeek().usedCheckpoint ? "checkpoint" : "walked", worstStep, touched, t->checkpointCount(),
- t->checkpointBytes() >> 20, t->extraBytes() >> 20);
- if (limits) {
- CHECK(full < 400.0);
- CHECK(back < 400.0);
- CHECK(worstStep < 60.0);
+ CHECK(t->seek(d, last));
+ CHECK(maxDiff(d.mesh.positions, end) == 0.0f);
+ auto pct = [](std::vector<double> v, double q) {
+ if (v.empty()) return 0.0;
+ std::sort(v.begin(), v.end());
+ return v[std::min(v.size() - 1, size_t(q * double(v.size())))];
+ };
+ std::printf(" timeline %.1fM tris (%.1fM verts), %d strokes (avg %zu, max %zu verts; %zu kept by the undo budget): "
+ "build %.0f ms, strokes avg %.0f ms, capture avg %.1f ms\n"
+ " scrub 1 step: p50 %.1f ms, max %.1f ms | to start %.0f ms (%s) | to end %.0f ms (%s) | random jumps p50 %.0f ms, "
+ "max %.0f ms (%d of 20 from checkpoints)\n"
+ " memory: mesh RSS %.2f GB, undo %.2f GB, timeline extras %.2f GB, checkpoints %zu = %.2f GB (every %zu steps), "
+ "process RSS %.2f GB\n",
+ double(d.mesh.triangleCount()) / 1e6, double(d.mesh.vertexCount()) / 1e6, strokes, touchedSum / size_t(strokes),
+ touchedMax, last, buildMs, strokeMs / strokes, syncMs / strokes, pct(stepMs, 0.5), pct(stepMs, 1.0), toStart,
+ startCk ? "checkpoint" : "walked", toEnd, endCk ? "checkpoint" : "walked", pct(jumpMs, 0.5), pct(jumpMs, 1.0), jumpsCk,
+ double(rssMesh - std::min(rssMesh, rss0)) / double(1u << 30), double(d.undo.undoBytes()) / double(1u << 30),
+ double(t->extraBytes()) / double(1u << 30), t->checkpointCount(), double(t->checkpointBytes()) / double(1u << 30),
+ t->checkpointEvery, double(residentBytes()) / double(1u << 30));
+ if (limits) { // generous: other work on the machine shares the cores
+ CHECK(pct(stepMs, 0.5) < 50.0);
+ CHECK(toStart < 1500.0);
+ CHECK(toEnd < 1500.0);
}
}
diff --git a/tools/benchmark/submit.py b/tools/benchmark/submit.py
new file mode 100644
index 00000000..3abafa44
--- /dev/null
+++ b/tools/benchmark/submit.py
@@ -0,0 +1,213 @@
+#!/usr/bin/env python3
+# SculptForge - open source digital sculpting
+# SPDX-License-Identifier: GPL-3.0-or-later
+"""Checks proof mode results (sculptforge --benchmark) and adds them to the website's list.
+
+ submit.py check result.json [...] validate and print a summary
+ submit.py add result.json --name NAME [--video URL] [--results website/benchmarks/results.json]
+ submit.py selftest check the validator against a made-up result
+
+The format is described in docs/benchmark.md (schema "sculptforge-benchmark/1").
+"""
+import argparse
+import json
+import pathlib
+import sys
+
+SCHEMA = "sculptforge-benchmark/1"
+ROOT = pathlib.Path(__file__).resolve().parents[2]
+DEFAULT_RESULTS = ROOT / "website" / "benchmarks" / "results.json"
+PCT = ("p50", "p95", "p99", "max", "mean")
+
+
+def _num(v):
+ return isinstance(v, (int, float)) and not isinstance(v, bool) and v == v and v >= 0
+
+
+def validate(doc):
+ """Returns a list of problems (empty: valid)."""
+ errs = []
+
+ def need(obj, key, kind, where):
+ if not isinstance(obj, dict) or key not in obj:
+ errs.append(f"{where}: missing '{key}'")
+ return None
+ v = obj[key]
+ ok = {"str": isinstance(v, str), "num": _num(v), "obj": isinstance(v, dict), "list": isinstance(v, list),
+ "bool": isinstance(v, bool)}[kind]
+ if not ok:
+ errs.append(f"{where}.{key}: expected {kind}, got {type(v).__name__}")
+ return None
+ return v
+
+ def pct(obj, key, where):
+ p = need(obj, key, "obj", where)
+ if p is None:
+ return
+ for k in PCT:
+ if not _num(p.get(k)):
+ errs.append(f"{where}.{key}.{k}: expected a number >= 0")
+ if all(_num(p.get(k)) for k in PCT) and not (p["p50"] <= p["p95"] <= p["p99"] <= p["max"]):
+ errs.append(f"{where}.{key}: percentiles out of order")
+
+ if not isinstance(doc, dict):
+ return ["the file is not a JSON object"]
+ if doc.get("schema") != SCHEMA:
+ errs.append(f"schema: expected '{SCHEMA}', got {doc.get('schema')!r}")
+ app = need(doc, "sculptforge", "obj", "root")
+ if app:
+ need(app, "version", "str", "sculptforge")
+ need(app, "commit", "str", "sculptforge")
+ need(doc, "date", "str", "root")
+ hw = need(doc, "hardware", "obj", "root")
+ if hw:
+ for k in ("cpu", "os", "gpu"):
+ need(hw, k, "str", "hardware")
+ need(hw, "logical_cores", "num", "hardware")
+ need(hw, "ram_gb", "num", "hardware")
+ st = need(doc, "settings", "obj", "root")
+ if st:
+ need(st, "vsync", "bool", "settings")
+ need(st, "pointer_hz", "num", "settings")
+ runs = need(doc, "runs", "list", "root") or []
+ if not runs:
+ errs.append("runs: empty")
+ for i, run in enumerate(runs):
+ w = f"runs[{i}]"
+ need(run, "label", "str", w)
+ need(run, "triangles", "num", w)
+ need(run, "vertices", "num", w)
+ phases = need(run, "phases", "list", w) or []
+ if not phases:
+ errs.append(f"{w}.phases: empty")
+ for j, ph in enumerate(phases):
+ pw = f"{w}.phases[{j}]"
+ need(ph, "name", "str", pw)
+ need(ph, "seconds", "num", pw)
+ need(ph, "frames", "num", pw)
+ need(ph, "fps", "num", pw)
+ pct(ph, "frame_ms", pw)
+ if isinstance(ph, dict) and "brush_radius_px" in ph:
+ pct(ph, "lag_ms", pw)
+ pct(ph, "lag_px", pw)
+ return errs
+
+
+def summary(doc):
+ hw = doc.get("hardware", {})
+ lines = [f"SculptForge {doc['sculptforge']['version']} ({doc['sculptforge']['commit']}), {doc['date']}",
+ f"{hw.get('cpu')} | {hw.get('gpu')} | {hw.get('ram_gb')} GB | {hw.get('os')}"
+ f" | vsync {'on' if doc['settings']['vsync'] else 'off'}"]
+ for run in doc["runs"]:
+ for ph in run["phases"]:
+ f = ph["frame_ms"]
+ s = f" {run['label']:>6} {ph['name']:<20} {ph['fps']:6.1f} fps frame p50 {f['p50']:5.1f} p95 {f['p95']:5.1f} p99 {f['p99']:5.1f} ms"
+ if "lag_ms" in ph:
+ s += f" trails {ph['lag_ms']['p50']:.0f} ms / {ph['lag_px']['p50']:.0f} px (p95 {ph['lag_ms']['p95']:.0f} ms)"
+ lines.append(s)
+ return "\n".join(lines)
+
+
+def compact(doc, name, video):
+ """The entry the website lists: everything but the long settings text."""
+ entry = {
+ "name": name,
+ "date": doc["date"],
+ "sculptforge": doc["sculptforge"],
+ "hardware": {k: doc["hardware"].get(k) for k in ("cpu", "gpu", "ram_gb", "logical_cores", "os")},
+ "vsync": doc["settings"]["vsync"],
+ "runs": [],
+ }
+ if video:
+ entry["video"] = video
+ for run in doc["runs"]:
+ r = {"label": run["label"], "triangles": run["triangles"], "phases": []}
+ for ph in run["phases"]:
+ p = {"name": ph["name"], "fps": ph["fps"], "frame_ms": ph["frame_ms"]}
+ if "lag_ms" in ph:
+ p.update(brush_radius_px=ph.get("brush_radius_px"), lag_ms=ph["lag_ms"], lag_px=ph["lag_px"])
+ r["phases"].append(p)
+ entry["runs"].append(r)
+ return entry
+
+
+def load(path):
+ with open(path, encoding="utf-8") as f:
+ return json.load(f)
+
+
+def cmd_check(args):
+ bad = 0
+ for p in args.files:
+ try:
+ doc = load(p)
+ except (OSError, ValueError) as e:
+ print(f"{p}: {e}")
+ bad += 1
+ continue
+ errs = validate(doc)
+ if errs:
+ bad += 1
+ print(f"{p}: {len(errs)} problem(s)")
+ for e in errs:
+ print(" " + e)
+ else:
+ print(f"{p}: valid\n{summary(doc)}")
+ return 1 if bad else 0
+
+
+def cmd_add(args):
+ doc = load(args.file)
+ errs = validate(doc)
+ if errs:
+ print("Not added:\n " + "\n ".join(errs))
+ return 1
+ results_path = pathlib.Path(args.results)
+ data = load(results_path) if results_path.exists() else {"schema": "sculptforge-benchmark-list/1", "results": []}
+ entry = compact(doc, args.name, args.video)
+ key = (entry["name"], entry["date"])
+ if any((e.get("name"), e.get("date")) == key for e in data["results"]):
+ print("Already listed")
+ return 0
+ data["results"].append(entry)
+ results_path.parent.mkdir(parents=True, exist_ok=True)
+ results_path.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8")
+ print(f"Added to {results_path} ({len(data['results'])} results)")
+ return 0
+
+
+def cmd_selftest(_args):
+ pct = {"p50": 10, "p95": 20, "p99": 30, "max": 40, "mean": 12}
+ good = {"schema": SCHEMA, "sculptforge": {"version": "0.9.7", "commit": "abc1234"}, "date": "2026-11-01T00:00:00Z",
+ "hardware": {"cpu": "x", "os": "y", "gpu": "z", "logical_cores": 8, "ram_gb": 16},
+ "settings": {"vsync": False, "pointer_hz": 240},
+ "runs": [{"label": "5M", "triangles": 5e6, "vertices": 2.5e6,
+ "phases": [{"name": "stroke", "brush_radius_px": 60, "seconds": 6, "frames": 300, "fps": 50,
+ "frame_ms": pct, "lag_ms": pct, "lag_px": pct}]}]}
+ assert validate(good) == [], validate(good)
+ bad = json.loads(json.dumps(good))
+ bad["runs"][0]["phases"][0]["lag_ms"]["p95"] = 99 # above p99
+ del bad["hardware"]["gpu"]
+ assert len(validate(bad)) == 2, validate(bad)
+ assert compact(good, "me", None)["runs"][0]["phases"][0]["lag_px"] == pct
+ print("selftest ok")
+ return 0
+
+
+def main():
+ ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
+ sub = ap.add_subparsers(dest="cmd", required=True)
+ c = sub.add_parser("check")
+ c.add_argument("files", nargs="+")
+ a = sub.add_parser("add")
+ a.add_argument("file")
+ a.add_argument("--name", required=True)
+ a.add_argument("--video", default=None)
+ a.add_argument("--results", default=str(DEFAULT_RESULTS))
+ sub.add_parser("selftest")
+ args = ap.parse_args()
+ return {"check": cmd_check, "add": cmd_add, "selftest": cmd_selftest}[args.cmd](args)
+
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/website/benchmarks/index.html b/website/benchmarks/index.html
new file mode 100644
index 00000000..15ee4ece
--- /dev/null
+++ b/website/benchmarks/index.html
@@ -0,0 +1,146 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title>SculptForge Benchmarks</title>
+ <meta name="description" content="How responsive sculpting in SculptForge is on real computers: proof mode results submitted by users, with frame times and how far the stroke trails the pen on 5 to 100 million triangle meshes.">
+ <!-- Proof mode results (sculptforge --benchmark, Help > Benchmark). Data: results.json beside this page, kept by
+ tools/benchmark/submit.py; format in docs/benchmark.md. -->
+ <style>
+ @font-face { font-family: "Inter"; src: url("../fonts/Inter-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
+ @font-face { font-family: "Inter"; src: url("../fonts/Inter-SemiBold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
+ :root {
+ color-scheme: dark;
+ --bg: #0f0f12; --panel: #1b1b21; --border: #2a2a31;
+ --text: #ececf1; --muted: #a3a3ad; --accent: #f28c3c; --accent-2: #ffb06a; --good: #7fc28a; --warn: #e2b155; --bad: #e5604a;
+ }
+ @media (prefers-color-scheme: light) {
+ :root:not([data-theme="dark"]) { color-scheme: light; --bg: #f6f6f8; --panel: #ffffff; --border: #dcdce2; --text: #18181c; --muted: #5d5d66; --accent-2: #b5560f; }
+ }
+ * { box-sizing: border-box; }
+ body { margin: 0; background: var(--bg); color: var(--text);
+ font: 400 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
+ main { max-width: 1100px; margin: 0 auto; padding: 32px 16px 64px; }
+ h1 { font-size: 1.9rem; margin: 0 0 4px; letter-spacing: -0.01em; }
+ h2 { font-size: 1.15rem; margin: 32px 0 8px; }
+ a { color: var(--accent-2); }
+ .muted { color: var(--muted); }
+ .small { font-size: 0.85rem; }
+ .card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 16px 0; }
+ .filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 16px 0; }
+ select { font: inherit; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; }
+ .scroll { overflow-x: auto; }
+ table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 0.92rem; }
+ th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
+ th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; }
+ td.num { text-align: right; }
+ .ok { color: var(--good); } .meh { color: var(--warn); } .slow { color: var(--bad); }
+ code { background: var(--panel); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 0.9em; }
+ .empty { padding: 24px; text-align: center; }
+ </style>
+</head>
+<body>
+<main>
+ <p class="small"><a href="../index.html">SculptForge</a></p>
+ <h1>Benchmarks</h1>
+ <p class="muted">How responsive sculpting is on real computers, measured by SculptForge's proof mode and submitted by the
+ people who ran it. Each row is one mesh size of one run.</p>
+
+ <div class="card small">
+ <strong>What the numbers mean.</strong> Proof mode plays a scripted pen stroke (240 pointer samples a second) through the
+ same code a real pen goes through, on spheres of 5, 20 and 33 million triangles (100 million with enough memory).
+ <em>Frame</em> is the time per frame: the median (p50) and the 95th / 99th percentile, the hitches you feel.
+ <em>Trails</em> is how far the stroke on screen is behind the pointer: from the pointer sample to the frame that shows it
+ handed to the display, in milliseconds, and the same distance along the path in pixels. Lower is better everywhere.
+ Vertical sync is off unless noted. Every run also records a video with these numbers on screen.
+ </div>
+
+ <div class="filters">
+ <label>Mesh <select id="size"><option value="">all sizes</option></select></label>
+ <label>Phase <select id="phase">
+ <option value="stroke">60 px brush stroke</option>
+ <option value="large brush stroke">240 px brush stroke</option>
+ <option value="orbit">turning the view</option>
+ </select></label>
+ <span class="muted small" id="count"></span>
+ </div>
+
+ <div class="scroll">
+ <table>
+ <thead><tr>
+ <th>Mesh</th><th>Processor</th><th>Graphics</th><th>RAM</th><th class="num">fps</th>
+ <th class="num">Frame p50</th><th class="num">p95</th><th class="num">p99</th>
+ <th class="num">Trails p50</th><th class="num">p95</th><th>Version</th><th>By</th><th>Video</th>
+ </tr></thead>
+ <tbody id="rows"><tr><td colspan="13" class="empty muted">Loading results...</td></tr></tbody>
+ </table>
+ </div>
+
+ <h2>Run it yourself</h2>
+ <p>In SculptForge: <strong>Help &gt; Benchmark</strong>. From a terminal: <code>sculptforge --benchmark</code>. Both write a
+ JSON result and an MP4 of the run.</p>
+ <h2>Submit a result</h2>
+ <ol>
+ <li>Run it on a quiet machine (close other heavy programs).</li>
+ <li>Check the file: <code>python3 tools/benchmark/submit.py check result.json</code>.</li>
+ <li>Add it: <code>python3 tools/benchmark/submit.py add result.json --name "your name" --video https://...</code>, and
+ open a pull request with the change to <code>website/benchmarks/results.json</code>, or attach the JSON to an
+ <a href="https://github.com/islandmed/SculptForge/issues">issue</a>.</li>
+ </ol>
+ <p class="small muted">The file format: <a href="https://github.com/islandmed/SculptForge/blob/main/docs/benchmark.md">docs/benchmark.md</a>.</p>
+</main>
+<script>
+(function () {
+ "use strict";
+ const rows = document.getElementById("rows"), sizeSel = document.getElementById("size"),
+ phaseSel = document.getElementById("phase"), count = document.getElementById("count");
+ let results = [];
+ const esc = (s) => String(s == null ? "" : s).replace(/[&<>"]/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;" }[c]));
+ const ms = (v) => (typeof v === "number" ? v.toFixed(v < 10 ? 1 : 0) + " ms" : "-");
+ // Frame-time colour: under a 60 Hz frame, under two, slower.
+ const cls = (v) => (typeof v !== "number" ? "" : v <= 16.7 ? "ok" : v <= 33.4 ? "meh" : "slow");
+ function cell(v, unit) { return `<td class="num ${cls(v)}">${unit ? unit(v) : ms(v)}</td>`; }
+ function render() {
+ const size = sizeSel.value, phase = phaseSel.value, out = [];
+ for (const r of results) {
+ for (const run of r.runs || []) {
+ if (size && run.label !== size) continue;
+ const ph = (run.phases || []).find((p) => p.name === phase);
+ if (!ph) continue;
+ out.push({ r, run, ph });
+ }
+ }
+ out.sort((a, b) => (a.run.triangles - b.run.triangles) || ((a.ph.frame_ms || {}).p50 - (b.ph.frame_ms || {}).p50));
+ count.textContent = out.length ? `${out.length} row${out.length === 1 ? "" : "s"}` : "";
+ if (!out.length) {
+ rows.innerHTML = `<tr><td colspan="13" class="empty muted">No results yet${size || phase ? " for this choice" : ""}. Be the first: run proof mode and submit yours.</td></tr>`;
+ return;
+ }
+ rows.innerHTML = out.map(({ r, run, ph }) => {
+ const hw = r.hardware || {}, f = ph.frame_ms || {}, lag = ph.lag_ms, px = ph.lag_px;
+ const trails = (o, p) => (o ? `${o[p].toFixed(0)} ms` + (px ? ` / ${px[p].toFixed(0)} px` : "") : "-");
+ return `<tr><td>${esc(run.label)}</td><td>${esc(hw.cpu)}</td><td>${esc((hw.gpu || "").split(",")[0])}</td>` +
+ `<td>${esc(hw.ram_gb)} GB</td><td class="num">${esc(ph.fps)}</td>` +
+ cell(f.p50) + cell(f.p95) + cell(f.p99) +
+ `<td class="num">${trails(lag, "p50")}</td><td class="num">${trails(lag, "p95")}</td>` +
+ `<td>${esc((r.sculptforge || {}).version)}${r.vsync ? " (vsync)" : ""}</td><td>${esc(r.name)}</td>` +
+ `<td>${r.video ? `<a href="${esc(r.video)}" rel="nofollow noopener">watch</a>` : "-"}</td></tr>`;
+ }).join("");
+ }
+ fetch("results.json", { cache: "no-cache" })
+ .then((res) => (res.ok ? res.json() : Promise.reject(res.status)))
+ .then((data) => {
+ results = Array.isArray(data.results) ? data.results : [];
+ const sizes = [...new Set(results.flatMap((r) => (r.runs || []).map((x) => x.label)))];
+ const tris = Object.fromEntries(results.flatMap((r) => (r.runs || []).map((x) => [x.label, x.triangles])));
+ sizes.sort((a, b) => tris[a] - tris[b]).forEach((s) => sizeSel.add(new Option(s + " triangles", s)));
+ render();
+ })
+ .catch(() => { rows.innerHTML = '<tr><td colspan="13" class="empty muted">The results could not be loaded.</td></tr>'; });
+ sizeSel.addEventListener("change", render);
+ phaseSel.addEventListener("change", render);
+})();
+</script>
+</body>
+</html>
diff --git a/website/benchmarks/results.json b/website/benchmarks/results.json
new file mode 100644
index 00000000..4e3183a5
--- /dev/null
+++ b/website/benchmarks/results.json
@@ -0,0 +1,4 @@
+{
+ "schema": "sculptforge-benchmark-list/1",
+ "results": []
+}