Page MenuHome

Time to set object attribute increases linearly with number of objects in the scene
Closed, ArchivedPublic


System Information
Windows 10

Blender Version
Broken: 2.79.0 / 2.79.4

Short description of error
When I try to instantiate a large number N of objects in a scene, it requires a quadratic time (N^2)
perform this task. The time to modify an object attribute increases linearly with the number of objects in
the scene.

If there are 10000 objects in the scene, it will take 10 times longer to set an object location than if there were
only 1000 objects.

Is this time cost a known limitation of Blender?

I don't use any GUI / Viewport, only the Python script.

Exact steps for others to reproduce the error
Run the attached script with blender. It uses timeit to measure execution time.
It creates an empty object, and then it creates a large number of duplicates, measuring for each of these the
time required to set the object x-location.
It prints the average measured time (to set 1 location) for different number of objects in the scene.
This time increases linearly with the number of objects.

The output I get:
Time to set one object location (mean from 0 to 5000 objects): 0.000012
Time to set one object location (mean from 0 to 10000 objects): 0.000026



Event Timeline

Joshua Leung (aligorith) closed this task as Archived.Jul 27 2018, 7:02 AM
Joshua Leung (aligorith) claimed this task.

Yes, these are known limitations that are tied fairly deeply into Blender's data structures and infrastructure, from when it was designed in the early 90's.

In short, all datablocks are stored as doubly-linked lists, sorted on creation (i.e. insertion sort), and processed sequentially (except when being evaluated, where a multi-threaded dependency graph/evaluation engine are now being used). This works perfectly fine for most typical scenes that artists work with interactively (and various scene management/grouping techniques can be used to tackle scenes with larger numbers of assets).

There are no plans to make any changes on this front in the short to mid term. A few years ago, Ton mentioned that the earliest we would consider rethinking some of these issues is with Blender 3.0. Until then, this fall under the "won't fix" category

Thanks, perfect answer!