Skip to content

Profiling the Fennel Runtime

  • Set SPACE_FENNEL_PROFILE=1 (or any truthy value) to enable the existing frame profiler that logs section timings to stdout when a frame exceeds the configured threshold.
  • Run ./build/space -m prof-scene to profile scene creation plus the first update with the flamegraph profiler. Without configuration the script writes prof/space-scene-profile.folded; override the destination via SPACE_FENNEL_FLAMEGRAPH=/tmp/scene.folded or disable the run entirely by setting it to 0, false, or off. The output is a collapsed stack file compatible with standard flamegraph tooling like flamegraph.pl.
  • Run ./build/space -m prof-object-browser-drag (or make prof target=object-browser-drag) to profile the Movables-driven drag loop for the object-browser dialog. The script reconfigures the scene to focus on the widget, simulates a long drag path, and records stacks to prof/object-browser-drag.folded by default.
  • Run ./build/space -m prof-scroll-inputs (or make prof target=scroll-inputs) to profile scrolling a list of 100 multiline input widgets (100 lines each) from top to bottom, writing to prof/scroll-inputs.folded by default.
  • After running a profiler script, generate SVG/PNG visualizations with make prof target=scene (or call python3 scripts/prof.py scene directly). The helper ensures folded, SVG, and PNG files (prof/<target>.folded|.svg|.png) live together in the prof/ directory, prints a concise textual summary of the heaviest stacks/leaf frames, and supports any prof-* module. Pass additional args via make prof target=scene args="--skip-images" to only keep the folded data/summary when flamegraph tooling is unavailable.