Performance enhancement of current rudimental 3D renderer? #2549
-
|
I have a severely dumbed down version (original has 2500 lines of code), of a much larger program provided here and I'm wondering if it's possible to correctly assess the culprit and increase its performance. My "educated" guess would be that it all boils down to how the rendered texture data is processed down to DPG, which is currently via dpg.set_value, which I assume is done solely on the CPU side. That's one issue, there's another one that I also guess has to do with the alleged infamous CPU bottleneck. Whenever I have active key handlers and I press and hold any keyboard button as I move around the scene everything slows down significantly. You can test it out yourself, by panning in the scene with middle mouse button and holding down the shift key simultaneously, you'll especially notice that the tooltip lags behind the mouse pointer. Keep in mind that the program is multi-thread as it's supposed to be by design, setting it to main thread is not an option. Also note that everything I've described is much worse in the original program, there the constant average is 17ms and the sudden decrease in display speed is much worse during a key press, it practically comes to a full stop. Even though I took precautions on how often and in which circumstances the original program has to render, when it comes to mouse movement, trust me when I say that it pretty much has to render during most of its movement. So completely avoiding rendering during mouse movement is not an option. It goes without saying, but the slowdowns are not reflective in the ms counter but purely visually. TL;DR; EDIT: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
After some digging around, I've reached a subjective conclusion that there isn't unfortunately a lot more that could be done here except for switching to alternatives that offer direct reading from render textures, which is precisely what I did. In fact, I've tested two of them, pyimgui and imgui_bundle respectively. As already mentioned, both of them support direct reading from render textures, they happen to differ on the amount and type of widgets they have. For instance, pyimgui doesn't have an embedded color picker, while on the other hand imgui_bundle does. So make sure to read on their respective documentation in order to deduce which one might suit your needs best. And yes, my rendering time reduced from 17ms down to 1.5 ms on average, which is pretty much what I've expected. And since image transfer is exclusively handled by the GPU the CPU is freed for the most part, therefore there's no more issues when invoking keyboard events. Here's also basic rendering setup for each of the two libraries: P.S |
Beta Was this translation helpful? Give feedback.
After some digging around, I've reached a subjective conclusion that there isn't unfortunately a lot more that could be done here except for switching to alternatives that offer direct reading from render textures, which is precisely what I did. In fact, I've tested two of them, pyimgui and imgui_bundle respectively. As already mentioned, both of them support direct reading from render textures, they happen to differ on the amount and type of widgets they have. For instance, pyimgui doesn't have an embedded color picker, while on the other hand imgui_bundle does. So make sure to read on their respective documentation in order to deduce which one might suit your needs best.
And yes, my ren…