-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Profiling performance of rendering #664
Comments
I don't really understand how you timed this. When profiling code like this, I'd recommend using something like https://github.com/pyutils/line_profiler since it shows per line how much time was spent on it. |
Thanks for the advice, I'll do it as well. Bottom line of this investigation is: |
I'm not sure what part of the messaging that could be. It has to be something with opengl since the rendering is so much faster if you only display a few lines. But i do have the feeling that you might be on to something here that I missed the last few times that I tried profiling. Problem is; I don't know what I missed... |
Just why I stumbled about it. I hacked in some caching of VBOs. |
I managed to find it what is causing it; it's the frame swap. I don't know why that would take so much longer than the actual rendering... |
Where is it in the code? |
It's in Qt itself. The QQUickWindow has a number of stages: https://doc.qt.io/qt-5/qquickwindow.html#RenderStage-enum I've been digging around in the documentation of Qt and it seems that the swap stage is when the actual openGL calls that are queued are made. So in that sense it makes sense that the swap takes a long time. I've hooked it up to QtCreator to debug this a bit, and this is a screenshot from what the scenegraph is doing: The bar before the swap is the actual render (which is 56.8 ms). |
What surprises me that caching the VBOs has so little impact on the performance. |
The thing is that we use a shader to get the 3D effect of the layers. We could consider pre-generating the verts and send that to be rendered. It might make it faster at the expense of more pre-computation. |
Still my gut feeling is that VBO caching should have significant effect even with the shaders. But your idea is good and Cura's old approach is exactly this. I'll try VBO caching with the old approach. |
We could also do the pre-generating in C++ and make a python binding. I do agree with your gut feeling though. The VBO caching should have more effect. |
Update from my side:
I'll hack in the tubes on the cpu now and do some benchmarking. |
What I have done now: Long story short, I don't think that creating the tubes initially and then cache them, will work out. In case of 1fps, one can have a simple view (i.e. lines) for navigating and then rendering the ordinary view afterwards for the "static" situation. Though, my resources are slipping away and I won't make this in the short term. |
Could you share the project file to create the tubes file (and the tubes file itself?). It would help me to convince people that this is worth the effort. |
(1) (2) I had a look at Simplify3d and PrusaSlicer. They are about 10x faster. |
Did a PR (both Uranium, for the actual VAO issues and Cura, for the shader implementation the fix implies) that might partially(?) fix this. Not sure if people get notifications if you just mention an issue, so here is a message as well :-) |
With Bremco's PR I observed a 4-fold performance increase in a large layer view. Whatever benchmarks you have now will be invalidated with the next release. Perhaps we can then consider this issue fixed? |
I deal with big data and some times preview rendering is here quite slow < 1 FPS.
Thus, I have now done some profiling and results are strange.
Take attached 3mf and code adjustments at the bottom of the issue. Then slice the sample and rendering the preview of the gcode.
The log states that (preview) rendering takes <0.3sec but I get >1sec if I manually stop the time with a stop watch (from "start rendering" to "end rendering"). In particular, >1sec is the real rendering time.
Do you know where the time is spent?
https://github.com/Ultimaker/Uranium/blob/master/UM/Qt/Bindings/MainWindow.py
UMS5_BigRepManifold.zip
The text was updated successfully, but these errors were encountered: