Skip to content

Conversation

@vdrn
Copy link

@vdrn vdrn commented May 22, 2025

If there are no gaps in the frame list, we can calculate the subslice of visible frames and avoid iterating through all frames.

Checklist

  • I have read the Contributor Guide
  • I have read and agree to the Code of Conduct
  • I have added a description of my changes and why I'd like them included in the section below

Description of Changes

show_frame_list scales poorly because it always iterates through all frames.
When there are no gaps in the frame list, we can calculate the subslice of visible frames and just iterate through them.

By my measurements, for 35 000 frames, this function takes about 0.5ms.
With this pull request, when there are no gaps in the frame list, it runs in constant 0.015ms.

AFAIK, gaps only happen when the user calls new_frame without having any scopes. In that case we can fall back to current behavior.

Related Issues

none

If there are no gaps in the frame list, we can calculate the
subslice of visible frames and avoid iterating through all frames.
@vdrn vdrn requested review from TimonPost and emilk as code owners May 22, 2025 09:03
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