Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance improvements to raw view loading #1679

Merged
merged 3 commits into from
Mar 28, 2024
Merged

Conversation

psavery
Copy link
Collaborator

@psavery psavery commented Mar 28, 2024

In order to make scrolling through images in the raw view faster, this PR provides several speed improvements to raw view loading. On my computer, it is now about 3.2x faster if there are no display masks and no overlays. Here are the performance improvements:

  1. The images dict was accidentally being created twice, which caused a performance hit. It is now only being created once.
  2. If there are no masks with a border-only setting, we avoid creating separate dictionaries for display images and computed images (we can re-use the display images as the computed images).
  3. If there are no overlays, we don't update the blit manager, which can be time-consuming.

psavery added 3 commits March 28, 2024 09:26
This adds a property to the mask manager that we can use to determine
whether or not there are border-only masks present.

If there are border-only masks present, then the display images and
computed images will be different, so we will have to re-create the
computed images from scratch.

If there are no border-only masks, then the display images and the
computed images are the same, and we can skip that extra computation
step by re-using the display images as the computed images.

Signed-off-by: Patrick Avery <[email protected]>
This was a little time consuming to do. Skip it if there are no overlays.

Signed-off-by: Patrick Avery <[email protected]>
This is to avoid creating the images_dict a second time, which can
be time consuming.

Now we pass it in as an argument.

Signed-off-by: Patrick Avery <[email protected]>
@psavery psavery requested a review from bnmajor March 28, 2024 14:35
Copy link
Collaborator

@bnmajor bnmajor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be working well for me! Awesome!

@psavery psavery merged commit 3a6c087 into master Mar 28, 2024
9 checks passed
@psavery psavery deleted the raw-view-faster-load branch March 28, 2024 17:27
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.

2 participants