Skip to content

fix: SG-43079: Optimize time it takes to display thumbnails when we re-display them - #1298

Open
deltag0 wants to merge 12 commits into
AcademySoftwareFoundation:mainfrom
deltag0:thumbnail-slowdown-on-update
Open

fix: SG-43079: Optimize time it takes to display thumbnails when we re-display them#1298
deltag0 wants to merge 12 commits into
AcademySoftwareFoundation:mainfrom
deltag0:thumbnail-slowdown-on-update

Conversation

@deltag0

@deltag0 deltag0 commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

fix: Optimize time it takes to display thumbnails when we re-display them

Summarize your change.

Instead of blocking the main thread and building the entire session manager from scratch with all thumbnails loaded if it's closed/updated, load thumbnails progressively, letting the main thread handle other events.

Describe the reason for the change.

When loading many files in RV, and closing/opening the session manager, it would freeze the application for an unreasonable amount of time.

Describe what you have tested and on which operating system.

Mac CY2025

List of changes

The goal was that when we open the session manager after all thumbnails are closed, we display the placeholder first, add the task to load the thumbnails in a queue, to run them alongside the main thread. We could also load the first 10 or so thumbnails before opening the session manager to avoid showing a placeholder.

@deltag0
deltag0 marked this pull request as ready for review June 8, 2026 20:30
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
@deltag0
deltag0 force-pushed the thumbnail-slowdown-on-update branch from 32242df to f9fe721 Compare June 12, 2026 20:29
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
// source and input each get their own render queue/timer/state
ThumbnailManager _source;
ThumbnailManager _input;
QDockWidget _dockWidget;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please try to align the members whenever possible

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

QMenu _createMenu;
QMenu _folderMenu;

ThumbnailRenderer thumbnailRenderer;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To be consistent, if it's a member, then it should be prepended with an underscore:
_thumbnailRenderer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

thumbnailRenderer._input.renderQueue = string[]();
thumbnailRenderer._input.progressiveRenderDeferred = string[]();
thumbnailRenderer._input.progressiveRenderPreviews = SourcePreviewWidget[]();
thumbnailRenderer._input.renderIdx = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The exact same sequence is repeated on line 2198. So it is a good candidate to encapsulate it into a dedicated method of the "ThumbnailManager" class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
}

class: ThumbnailManager

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Naming things is hard but I am not sure it is the best name for this class. Does it actually manage thumbnails ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Renamed to PreviewRenderQueue

// source and input each get their own render queue/timer/state
ThumbnailManager _source;
ThumbnailManager _input;
QDockWidget _dockWidget;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think the ThumbnailRender should own the _dockWidget. My understanding is that the ThumbnailRender should be optional - It should only be used when _previewsEnabled is true.
I would pass _dockWidget as an argument to the ThumbnailRenderer's constructor.
What do you think @eloisebrosseau ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with you. The Session Manager dock widget should not be inside the ThumbnailRenderer class and only pass as an argument to use it when needed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's fine, but it seemed like the SessionManagerMode class is a God class, it basically owns every single object. If that's fine, we can keep it that way.

Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
// source and input each get their own render queue/timer/state
ThumbnailManager _source;
ThumbnailManager _input;
QDockWidget _dockWidget;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree with you. The Session Manager dock widget should not be inside the ThumbnailRenderer class and only pass as an argument to use it when needed

Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
if (_thumbnailRenderer._source.renderIdx < _thumbnailRenderer._source.renderQueue.size())
{
_thumbnailRenderer._source.renderTimer.start(0);
}

@eloisebrosseau eloisebrosseau Jun 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

itemOfNode can return nil so you should validate its content like it's done in the rest of the code before assigning item in _viewTreeView.setIndexWidget(_viewModel.indexFromItem(item), w);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}
}

method: resetPreviews (void;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

resetPreviews is not called once, you should remove it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed

@eloisebrosseau eloisebrosseau Jun 29, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI, I still see this method in your latest changes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I removed it from the generated file, fixed now

Comment thread src/plugins/rv-packages/session_manager/session_manager.mu.in Outdated
@deltag0
deltag0 force-pushed the thumbnail-slowdown-on-update branch 7 times, most recently from fc4be0a to 5a85405 Compare June 29, 2026 19:08
Signed-off-by: deltag0 <victor.terme@autodesk.com>
deltag0 and others added 11 commits July 8, 2026 09:21
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <ioan.1931@gmail.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <ioan.1931@gmail.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <ioan.1931@gmail.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
Signed-off-by: deltag0 <ioan.1931@gmail.com>
Signed-off-by: deltag0 <victor.terme@autodesk.com>
@eloisebrosseau
eloisebrosseau force-pushed the thumbnail-slowdown-on-update branch from 5a85405 to 92bed4c Compare July 8, 2026 13:21
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.

3 participants