Outliner slow with massive 30000+ object scene

I wrote a Python script to generate the first floor of a space station which is 4 stories high to create a surface city aesthetic. The ring has a 2.8 kilometer radius with a 250 meter width. Here is a screen shot:

That loads fine. I then wrote another Python function to import a door handle and shop sign and place one for each shop. Here is a screen shot:

The script took way too long to do this. I learned that with each object import, the scene had to cycle through all the existing objects with a scene update function. As I had more and more objects, it took longer and longer to update. I rewrote the script to import the object once, then duplicate them and run bpy.context.scene.update() only once at the end. That was WAYYY faster. Also, instead of importing the objects 10000 times and instead linking them (while not duplicating the mesh data), it reduced the RAM usage. I was almost maxing out my 16GB of RAM before I made the switch. My 3D viewport was lagging a little and after switching to linked objects, it became more responsive.

I only have one problem left, the Outliner. The outliner is still very laggy. When I click the icon to hide the object, it can take 3+ seconds to take effect. If I move the mouse cursor during that 3 second delay, it might not even click what I originally clicked on. So it seems to not only lag with the update but with the key input.

I’m not sure how the outliner is programmed but I would imagine this shouldn’t be hard to fix. 30,000 objects in a hierarchy shouldn’t be that hard to handle. I guess it might be polling constantly and refreshing constantly and that’s why it’s so slow?

Any work arounds would be appreciated.

try to remove the history
might be faster

but that is about it

with so much objects blender has problem to deal with such long list
and update in scene

your lucky it is relatively fast

why don’t you use some normal map for this if possible
should be way faster!

happy bl