[Performance] Document web-build (WASM) profiling workflow — DevTools + emcc, sibling to #345 #346
Labels
No labels
Alpha Release Requirement
Bugfix
Demo Target
Documentation
Major Feature
Minor Feature
priority:tier1-active
priority:tier2-foundation
priority:tier3-future
priority:tier4-deferred
Refactoring & Cleanup
system:animation
system:documentation
system:grid
system:input
system:performance
system:procgen
system:python-binding
system:rendering
system:ui-hierarchy
Tiny Feature
workflow:blocked
workflow:needs-benchmark
workflow:needs-documentation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
john/McRogueFace#346
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
#345 stands up the native profiling rig (Callgrind + perf). Those tools are native-ELF/CPU-counter based and cannot profile WASM running in a browser — different execution substrate behind the browser sandbox. The web target needs its own, separate workflow. This is a lighter, docs-focused sibling to #345.
Key principle: minimize the web-specific surface
For C++/algorithmic hot-path work (#342/#343/#344 and similar), profile the native build as a proxy — the C++ source is identical across targets; only the LLVM codegen backend differs. Algorithmic cost, allocation counts, and comparison-cascade depth transfer. Do NOT re-confirm those on web.
Reserve browser profiling for genuinely web-specific costs that native can't predict:
SDL2Renderer.cpp) — a different codebase from SFMLALLOW_MEMORY_GROWTHrealloc stalls / JS heap interactionDeliverables (documentation)
make wasm-debug/make playground-debug(these already build with-g4 -gsource-map).--profiling-funcs— emit named WASM function symbols so the flame chart showsUIFrame::setPropertyinstead ofwasm-function[2317](web equivalent of "not stripped"). Determine which build variant should carry it.performance.now()is clamped (~100µs, Spectre mitigation) and fine-grained timers are gated behind COOP/COEP headers. The in-engineProfilerOverlay(which usesemscripten_get_now()) is good for "is this frame janky" but not microbenchmark precision on web — use DevTools sampling for precise numbers.Portable through-line
The in-engine
ProfilingMetrics/ProfilerOverlay(src/Profiler.*,GameEngine.h) compiles to every backend and is the one instrument identical on desktop and web — document it as the cross-target HUD, with the timer-coarsening caveat above.Related: #345 (native rig), #331, #342, #343, #344.
Refinement (2026-07-11): now depends on #341; scoped as the browser-deployment leg
Added dependency on #341. This issue's "portable through-line" is the in-engine
ProfilerOverlay/ProfilingMetricsHUD as the one instrument identical across desktop and web. But #341 reports thatget_metrics()draw_calls/ui_elements/render counters read 0 in windowed builds — so the HUD can't yet be documented as the authoritative cross-target instrument. Fix #341 first, then the docs point at something true.Scope (destination). This bucket is the browser-deployment leg of the agent environment (#55, plus #239 headless-browser testing). It's the loosest of the three enabling buckets: desktop Jupyter (#54) renders via screenshot-to-cell on the native build, so WASM instrumentation only becomes load-bearing if the notebook / agent env runs in-browser (JupyterLite-style). Scope the docs effort accordingly.
Cross-ref #347 (SFML vs SDL2/WebGL renderer parity) — the other genuinely web-specific unknown that native profiling can't proxy.