[Bf-committers] Sloppy code, slowing down Blender

Jacob Merrill blueprintrandom1 at gmail.com
Wed Apr 9 03:11:13 CEST 2014


Side note, if camera distance is exposed each frame, why not make that
available to the python api? Like
object.cameraDistance. ?
On Apr 8, 2014 6:09 PM, "Jacob Merrill" <blueprintrandom1 at gmail.com> wrote:

> What about collecting a list of all objects with LOD settings when p is
> pressed, and then using the cameras view area to filter further? Also same
> for speakers? Only loop through objects that are on a list?
> On Apr 8, 2014 6:02 PM, "Campbell Barton" <ideasman42 at gmail.com> wrote:
>
>> Hi, recently I noticed that Blender is slower then it was back in 2.4x
>> days when it comes to many objects (just empties).
>>
>> I recall having 80'000 objects in a scene, while it was very slow to
>> duplicate, Blender was usable apart from that.
>>
>>
>> Two recent examples:
>>
>> ---
>> On a test with ~20,000 objects I found blender was continuesly looping
>> over all scenes (and set scenes recursively), to check if any of the
>> objects were speakers, to update their sound time.
>> Even when there were no speakers in the blend file. (Now theres a
>> quick check to avoid this in `sound_update_scene`)
>>
>> ---
>> Today I just stubmed upon `BKE_object_lod_update` being called on
>> every redraw for every 3DView for every object, in every set-scene
>> recursively and every dupli. Incase the game engine is enabled and
>> LOD's are used.
>>
>> This stuff should really come up in code-review,
>> (I can take some blame for not reviewing the patch in this case...)
>>
>> While I'm sure its not the main bottleneck in blenders viewport speed,
>> its just sloppy and can be easily avoided (skip the loop if the
>> game-engine is disabled for example, and only operate on objects which
>> are visible!).
>>
>> Sometimes bad hacks are hard to avoid, in those cases at least add a
>> comment that the code is inefficient with some explanation why a
>> better method can't be used.
>>
>>
>> For now I'll ifdef out this code when the game engine is disabled, but
>> really I think we should be a bit better picking up on this stuff
>> especially when it effects all users.
>>
>> --
>> - Campbell
>> _______________________________________________
>> Bf-committers mailing list
>> Bf-committers at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-committers
>>
>


More information about the Bf-committers mailing list