mmmrqs / bl_ui_widgets

UI Widgets for Blender 2.8 and newer versions
GNU General Public License v3.0
46 stars 5 forks source link

performance #6

Closed SuddenDevelopment closed 1 year ago

SuddenDevelopment commented 1 year ago

I swear I'll send a PR soon, trying to get a product launched :)

I recentley noticed that Blender open to a default cube is at ~2% CPU with panel closed and with it open it jumps to ~10-20% CPU

close the panel and it goes back down. This is a pretty big overhead. Ideas on how to reduce it?

FYI I added a click number prop since you last saw it but it's fairly basic: Screenshot 2023-01-13 at 1 43 16 PM

mmmrqs commented 1 year ago

Hi @SuddenDevelopment -- nice to see that your panel is evolving more and more.

Well, I do not have much knowledge about the subject re Blender API. This was my very first work with Blender and also the first time ever I coded anything in Python. The most I did was to organize the existing widget library created by @Jayanam as well as adding some new features.

The only thing I can think about holding process time is because it has a modal operator event firing every 0.1 seconds and during that event some stuff is verified. You thing you could try is to increasing the time gap to 0.2 or more (however that may impact responsiveness of your panel during user interaction). Let me ask you this: Does that increase in CPU utilization happen only at the moment you open a file or it keeps up during all the time the panel is opened? Because if it is only when opening a file, I wouldn't worry much about it.

I have used my References Camera Panel (made with this library) every day, for months, while making a car model and it didn't bothered me not even once. That car which I had to model over some 200 still images gotten from a 720p video (it is from an old TV series) was the very reason I had to make this widgets and my Panel addon. Otherwise it would have been an impossible mission. There are no blueprints or other 3D views available anywhere to get its correct dimensions.

And I am now finishing up a new addon and also plan to improve my Panel a bit before embarking on the next mission: to make a model for another old TV series vehicle which is gonna be more complex yet.

SuddenDevelopment commented 1 year ago

@mmmrqs the increase in CPU stays constant. Not just when it's opened. Hopefully it;'s not a big issue for anyone else

SuddenDevelopment commented 1 year ago

solved. the timer handler was causing redraws 10x/second,I set it to 1 second and it's good again, as you suggested.

mmmrqs commented 1 year ago

@SuddenDevelopment I am glad that it is working better in that way. I am still under the impression that the performance issue relies in the 'BGL' graphic module that I have to call for drawing the widgets on screen. The other addon I am coding right now also uses a Timer and it does not show any increase in CPU usage, but it is an addon that does not draw anything on screen. Anyways I am not sure about this, it is just an speculation on my part.