import bpy import time OBJECT_NUMBER = 100_000 collection = bpy.context.collection def objects_create(): objects = [] new = bpy.data.objects.new for i in range(OBJECT_NUMBER): obj = new(str(hash(hex(i))), None) objects.append(obj) if (i % 1_000) == 0: print(i) return objects def objects_collection_link(collection, objects): timer_start = time.time() link = collection.objects.link for ob in objects: link(ob) time_delta = time.time() - timer_start print("Time to link objects into scene:", len(objects), time_delta) def objects_collection_unlink(collection, objects): timer_start = time.time() unlink = collection.objects.unlink # Reversed (worst case). # without this unlinking is very fast even without optimizations. for ob in reversed(list(objects)): unlink(ob) time_delta = time.time() - timer_start print("Time to unlink:", len(objects), time_delta) objects = objects_create() objects_collection_link(collection, objects) for ob in objects: ob.select_set(True) objects_collection_unlink(collection, objects)