Blender editing performance with many datablocks #68938

Open
opened 2019-08-20 22:55:06 +02:00 by Dalai Felinto · 15 comments

Editing scenes with many datablocks can be slow, for example adding, deleting or duplicating many objects.

Adding or deleting a single object has time complexity O(N), where N is the number of objects. This is due to unique name tests, looping over all datablocks to clear all pointers, and other operations that require accessing many datablocks. In general all such operations must become O(log(N)) or O(1), along with possible access of just the other datablocks linking to it.

Undo push (#60695) and dependency graph rebuild are also O(N). We are not trying to improve those as part of this task, and note these can be run once after making many edits.

Practical steps to reduce time complexity would be:

  • Store two-way links for all (non-COW) data-blocks, so that iterating over all datablocks that link to a given datablock is fast. There are transient data structures for this, but it should become permanent. Every id_us_min() and id_us_plus() should be turned into an operation that sets the datablock pointer and creates a link in the other direction as well.
  • Extend or modify datablock lists in Main to support quick testing for duplicate names.
  • Change view layer collection syncing to not require looping over all objects.
Editing scenes with many datablocks can be slow, for example adding, deleting or duplicating many objects. Adding or deleting a single object has time complexity O(N), where N is the number of objects. This is due to unique name tests, looping over all datablocks to clear all pointers, and other operations that require accessing many datablocks. In general all such operations must become O(log(N)) or O(1), along with possible access of just the other datablocks linking to it. Undo push (#60695) and dependency graph rebuild are also O(N). We are not trying to improve those as part of this task, and note these can be run once after making many edits. Practical steps to reduce time complexity would be: * Store two-way links for all (non-COW) data-blocks, so that iterating over all datablocks that link to a given datablock is fast. There are transient data structures for this, but it should become permanent. Every `id_us_min()` and `id_us_plus()` should be turned into an operation that sets the datablock pointer and creates a link in the other direction as well. * Extend or modify datablock lists in `Main` to support quick testing for duplicate names. * Change view layer collection syncing to not require looping over all objects.
Author
Owner

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Added subscriber: @PaulMelis

Added subscriber: @PaulMelis

#66613 might have some useful information

#66613 might have some useful information

Added subscriber: @filibis

Added subscriber: @filibis
Brecht Van Lommel changed title from Blender performance with many objects to Blender editing performance with many datablocks 2019-09-29 12:33:49 +02:00

Added subscriber: @AlbertoVelazquez

Added subscriber: @AlbertoVelazquez

Added subscriber: @christopher.burns

Added subscriber: @christopher.burns

Is there an ETA for this? Even parenting several thousand objects to an empty takes 20+ minutes, which seems impossible as it's--logically--just a pointer being set on each object

Is there an ETA for this? Even parenting several thousand objects to an empty takes 20+ minutes, which seems impossible as it's--logically--just a pointer being set on each object
Author
Owner

Experimental branch/patch: #60695 (Optimized per-datablock global undo)

Experimental branch/patch: #60695 (Optimized per-datablock global undo)

Added subscriber: @rwman

Added subscriber: @rwman

Added subscriber: @Moult

Added subscriber: @Moult

Added subscriber: @Noto

Added subscriber: @Noto

Added subscriber: @2046411367

Added subscriber: @2046411367

Added subscriber: @bblanimation

Added subscriber: @bblanimation

Added subscriber: @JanKaderabek

Added subscriber: @JanKaderabek
Contributor

Added subscriber: @RedMser

Added subscriber: @RedMser
Sign in to join this conversation.
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
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
12 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#68938
No description provided.