# Sequencer Performance Profiling

Task: `TODOS.phase-72.72.15.2.15`

Sequencer performance profiling is a V2Editor TimelineVisualizer surface for
estimating timeline playback cost, identifying heavy tracks, and producing
optimization suggestions before a cinematic sequence ships.

## Runtime API

- Panel spec: `FV2SequencerPerformanceProfilingPanelSpec`
- Request: `FV2SequencerPerformanceProfilingRequest`
- Track profile: `FV2SequencerPerformanceTrackProfile`
- Optimization row: `FV2SequencerPerformanceOptimization`
- Result: `FV2SequencerPerformanceProfilingResult`
- Enums: `EV2SequencerPerformanceOptimizationType`,
  `EV2SequencerPerformanceIssueType`

`ProfileSequencerPerformance` accepts a sequence, panel spec, and profiling
request. It estimates per-track playback cost, memory, and timeline item count;
flags tracks over the heavy-track budget; compares total cost against the frame
budget; and returns an optimized sequence when safe automatic optimization is
requested.

## Behavior

- The panel targets `TimelineVisualizer` and exposes frame budget, heavy-track
  budget, keyframe threshold, optimization, budget bars, and report export.
- Track profiles include `TrackId`, display name, `EV2SequencerTrackType`,
  keyframe count, timeline item count, estimated cost, memory, heavy-track
  state, suggested optimization, and optimization reason.
- Heavy tracks can suggest `DownsampleKeyframes`, `BakeAnimation`,
  `PreloadAudio`, `CollapseSubSequence`, `UseLOD`, or `ReduceCameraCuts`.
- Safe auto-optimization currently down-samples dense keyframe arrays while
  preserving first and last samples.
- Muted tracks are skipped by default and included only when the request asks
  for muted-track profiling.
- Non-blocking issues record heavy-track and frame-budget warnings; blocking
  issues reject invalid panel settings, invalid budgets, invalid sequences,
  empty profiles, and missing optimization targets.

## QA Inventory

- Panel: verify profiler widget metadata, frame/heavy-track budgets, keyframe
  threshold, optimization support, budget bars, and report export.
- Default profile: verify the default sequence emits one profile per unmuted
  track with positive cost and memory estimates.
- Heavy tracks: verify dense keyframe tracks are flagged, produce heavy-track
  ids, and emit playback-budget warnings when total cost exceeds the request.
- Optimizations: verify dense keyframes suggest `DownsampleKeyframes` and are
  eligible for safe auto-apply.
- Optimized sequence: verify auto-apply reduces keyframes to
  `MaxKeyframesBeforeDownsample` or less.
- Muted tracks: verify muted heavy tracks are skipped by default and included
  when requested.
- Off-path: reject invalid budgets and empty sequence profiles.

`js_repl` Playwright interaction was unavailable in this session and the
affected surface is Unreal editor data rather than browser-rendered UI, so
verification is through UE editor automation and contract gates.

## Verification

- `python3 V2/ue/Tools/check-v2-sequencer-performance-profiling.py`
- `V2.Editor.Sequencer.PerformanceProfiling`
- `python3 V2/ue/Tools/check-v2-editor-module.py`
- `python3 V2/ue/Tools/check-v2-ci-workflow.py`
