Skip to content

Support profiling compiled blocks - #350

Open
Joeclinton1 wants to merge 1 commit into
TurboWarp:developfrom
Joeclinton1:agent/compiled-debugger-profiling
Open

Support profiling compiled blocks#350
Joeclinton1 wants to merge 1 commit into
TurboWarp:developfrom
Joeclinton1:agent/compiled-debugger-profiling

Conversation

@Joeclinton1

Copy link
Copy Markdown

Summary

  • preserve Scratch block IDs through the compiler IR
  • emit debugger profiling callbacks before compiled blocks execute
  • finish the active profiling interval whenever a compiled thread yields or completes
  • only add profiling instrumentation when the debugger profiler is enabled during compilation

Why

The debugger timing profiler hooks into interpreted thread stepping, but compiled scripts bypass that path. As a result, line-by-line profiling and heatmaps cannot collect timings for compiled blocks.

This adds an opt-in runtime hook for the debugger so compiled execution can report the same block boundaries without affecting normal compiled projects.

Impact

This enables compiler-compatible line-by-line timings and heatmaps for the debugger work in TurboWarp/scratch-gui#1184. Projects that are not being profiled keep the existing generated code path.

Validation

  • npm run lint
  • npx tap --no-coverage --timeout=120 test/integration/execute.js

Related GUI PR: TurboWarp/scratch-gui#1184

@Joeclinton1
Joeclinton1 marked this pull request as ready for review August 9, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant