-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop looping execution #4516
Stop looping execution #4516
Conversation
… and execution start looping also it leads to a problem that not all user scene events are handled
What type of scene events can we expect not to be handled? |
Is that drop in the performance? It will render all my work useless if it is :/ |
No, I made a havy try to make the problem to be more visible. In fast trees the difference of cause will be much smaller but it will be (most likely). |
I'll compare before and after and report. I'm counting a lot on the responsiveness when editing the scene because the trees I'm working on are analysing the surface-surface continuities. It is heavy by nature but was enough responsive to make an edit and read the results adjusting the quality of contacts in realtime |
I did several tests with four Sverchok code snapshots including:
All tests are made with blender-3.1.2-win-x64. The results will follow shortly.... |
Got similar problem to the one above but this one is not minor. As you can notice the curve drawing was stuck and not updated, even I finished editing the control polygon. Here this is easy to spot, but there are cases where it won't be so obvious and will lead to wrong results. This is the test file I'm using. test_new_update_system.zip NotUpdating.mp4 |
i wonder what happens if the task system didn't do this Lines 131 to 135 in ed954eb
|
The UI "flickering" disappears when raising the max_duration higher. Lines 42 to 45 in ed954eb
But I cannot measure if this makes the things go faster. Also the bigger problem stays. The trees are not updating to match the final scene changes. NoUIFlickering.mp4 |
@rendetto you have 100k samples evaluated, does the slowdown become progressively worse as you increase from say..100 samples to 1000 samples...2000 samples? i realized you aren't printing 100k samples using debug print (my bad!) |
Yes it gets progressively worse from low to high numbers. But it's predictable thing. I use this ridiculous sampling to test how the update system will hold. So this drop in performance is not unexpected but what was unexpected is that the tree execution stops before I finished editing the control points in the viewport. EDIT |
It's possible to switch logging level to debug mode in this case time update of a tree will be printed in the console. But this does not work for animation handler. I did not implement it purposely to gain better performance during animation but I did not try to measure the impact of printing something evry frame. Anyway it seems when debug mode is off the impact should be nearly nothing 🤔 I tried to compare the performance, not without difficulties, and it was surprising that Scene handler showed x1.5 speedup compare to animation handler. It might be related with garbage collector which is switched off during work of the Scene handler. Also the measurement can be inaccurate. Something could happen outside of the measured domain. The flickering is related with how showing of the progress work. When a node tree is light we does not show any progress because it is close to instant. But when execution time is slower then 0.15 sec the progress is starting to display. But in current case it is shown and it is instantly disappears because the rest nodes do their work pretty quick. To increase the This is how tasks currently work (scene events).
It shows that only 1 and 4 events (user edits of the mesh) will be handled by Sverchok tree. If 2 or 3 event will be last it means that there will be a difference with actual object position and last position which were read by Sverchok. I don't see elegant solution to fix this now. Probably we have to force users to do extra work by pressing select mause button or going into object mode to update final position properly for now. We have similar solution of pressing left and right arrow buttons to force node tree update. |
Thanks! I was able to measure ~150ms for a particular tree I'm testing currently in Scene Handler mode.
I guess for my particular process higher number works better despite it will make it hard to stop the tree execution.
Because I need to read a parameter while I'm editing the mesh it is not an option for me to nudge arrow keys to re-update the trees after I finished the editing. I will just raise "max_duration" from the code knowing what it will do, which is perfectly fine for me.
@Durman Can I propose a straight approach - for the newcomer who doesn't know of those effects it could be useful to have access to "max_duration" as a global parameter in the UI. Maybe somewhere here with the appropriate tooltip: |
I think what you need is uncancellable mode because changing of the max duration variable does not fix the problem. It just make the problem to appear on heavier trees (unless the value is upper big). In uncancellable mode the scene handler should behave similar to how animation handler currently works. Probably I can code something like this: max_duration = 10 if self.current.is_scene_update else 0.15 It will make havy trees a bit unsafe but it still will be possible to cancel their execution after 10 seconds (probably it can be less, 5 seconds?). |
…ich are impossible to handle
It seems now the scene handler works more pleasant. |
I guess 10s is reasonable time to cancel the execution.
Yes it is. I tested several different setups with heavy calculations and it works without problems. Thank you @Durman! |
@rendetto Thanks for the idea =) |
Addressed problem description
It fixes the problem when new scene events come during execution of a previous scene event
#4510 (comment)
Also it leads to a problem that not all user scene events are handled (probably this is lesser evil)
Closes #4510
Preflight checklist