Skip to content

perf: investigate redundant caption lookup passes during rendering #2523

Closed as not planned

Description

@ardjo-s

At 3d19c5cfa5e636107e78adde6d55be78404d4f23, find_active_caption_segment in crates/rendering/src/layers/captions.rs searches for an active segment, then scans again for an exit animation when none is active. CaptionsLayer::prepare uses this lookup per frame.

A candidate optimization is to retain the first animation candidate while searching for an active segment. It must preserve active-over-animation priority and original segment order, including overlaps and unsorted input.

Validation needed:

  • Exact before/after selection equivalence, including timing boundaries.
  • Release benchmarks on synthetic caption lists, separating active frames, gaps and exit animations.
  • Reject the change if extra work on active frames outweighs the fallback savings.

This is a code-level performance hypothesis; no speedup or end-to-end playback/export improvement has been measured yet.

Activity

  1. linear commented on Oct 13, 2026

    @linear
  2. richiemcilroy commented on Nov 4, 2026

    @richiemcilroy
    Member

    Thanks for looking into this! Without a measured win we won't track this as an issue, but a PR with before and after numbers is welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions