Outliner ID remapping performance #94185
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#94185
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
ID remapping is the mechanism to replace id pointers with other values. This is used in different scenarios like file reading, removing id blocks, resyncing. Remapping in the outliner is slow. Reason is that per ID it goes over all tree elements (treestore).
Outliner has a reverse lookup, but isn't usable for cases where you only have a part of its key.
space_outliner->runtime->treehash can contain a GHash.
The key of the treehash is an encoding of:
Due to its encoding it is only possible to do a reverse lookup when all 3 elements are known. nr seems to be the index of a modifier it points to. Type is very divers and seems to implement multiple indexing in a single ghash.
Alternative 1: remapping user data
Use a custom reverse lookup for remapping. Current codebase would only benefit of having a reverse lookup during remapping. Adding a user data to the remapping process needs many changes in the ID management control flow.
Current control flow
In this situation the remapping should be stored on the highest level and requires a lookup to the user data along the way.
This lookup can be eliminated by adding a remap process init and free function or by lazy initialization with a free function.
Alternative 2: Bulk test
A hacky alternative is to use the space_outliner->runtime->treehash and loop over all possible
TreeStoreElem.type
. This leads to unmaintainable code and many lookups that doesn't count.The number of searches could be reduced by keeping track of each used TreeStoreElem.type per IDType.
This data still needs to be stored in the space data and would still require a free function as we don't want to keep this data around.
Alternative 3: Remap multiple.
Create arrays containing all the remappings that needs to be done. In stead of doing them one by one do perform them for the whole array at once.
This would need a large refactoring of existing code (delete, loading, resync etc) with a lot of unknows. To mitigate the complexity we could support both (single remap and multiple remap. And migrate per functionality, but that has the possibility that the current implementation will never be phased out.
Alternative N: ...
Placeholder for future ideas.
Conclusion
Conclusion so far is that there might not be an easy clean solution. Personally would push for the remap multiple, but it has risks that I cannot oversee without doing some experiments.
Added subscribers: @Jeroen-Bakker, @mont29, @brecht, @dfelinto
Changed status from 'Needs Triage' to: 'Confirmed'
Added subscriber: @lichtwerk
Just noting (though a bit OT) that it also spawns popups for all selected IDs (all on top of each other), see #93814 (Outliner: Remap Users spawns multiple dialogs on top of each other)
Outliner remappingto Outliner ID remappingOutliner ID remappingto Outliner ID remapping performanceWhy is it remapping pointers in the outliner tree, instead of rebuilding the tree? Is it to preserve the tree expand/collapse state for the remapped data, because it's somehow really noticeable when you use the remap operation in the outliner?
At least as far as I know, for most operators that edit datablock relations we just rebuild the tree, it's not obvious to me why we do something else here.
Also makes me wonder if resync could do something similar to undo and preserve datablock memory locations, so we don't even have to remap pointers.
Added subscriber: @Garek
Added subscriber: @GeorgiaPacific
This issue was referenced by
a21bca0e20
This issue was referenced by
948211679f
Changed status from 'Confirmed' to: 'Resolved'