-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Unnecessarily slow Preview #2636
Comments
Please share the infos from Help->Library info. I can't reproduce that at all on Debian/Testing with 2018.12.08.nightly (git c257783). With numitems = 9999 I still get instant preview. Also there is no flashing here. Maybe this is due to different graphics drivers. Double click is a known issue but there's no general solution in sight yet. (#2466).
|
What graphic card and driver are you using? |
Interesting, so no progress bar at all I guess. Maybe you'd need to double up the amount of stuff created inside the loop if my hardware is working badly... the progress bar does have to appear for anything slow to happen. Here's the corresponding section of output from my Help->Library info: Qt graphics widget: QOpenGLWidget The card is a Radeon HD6870, not recent but well supported by the non-proprietary driver (allegedly). As far as I know the libraries are all up to date as far as Mint 18.3 is concerned, plus I manually installed the one newer (looks like it was OpenCSG-1.4.2) back in April which was needed. |
To make this more interesting, this example actually crashes OpenSCAD during normalization on my debug Mac build.. |
sure - Let me try
and I get as result
which is fine by me. I mean: Yes the preview starts reacting strangely, but that has more with the fact that the object is very thin relative to its size. |
Ok, hope you got the progress bar this time at least, starting from 0/1000? This is just 4s more than to draw the original (1/4 as complex) version, which I reckoned was was taking 1 to 2s not counting the 35s for the full progress bar. If you had the full progress bar from 0 upwards and took 13s, your machine is about 3x faster. Then I'd predict that you can preview anything in 1s if the progress bar doesn't appear at all, huge stuff in ~13s regardless of the exact size, with a rapid change from one to the other depending on how long the progress bar is up for. If you can get that, you're seeing what I have, just 3x less annoyingly slow. |
In debug mode the example from @MichaelPFrey takes 28 seconds here, commenting out the whole |
#2343 does indeed fix the crash - good call! Should look into getting that merged... |
I remember doing some openscad profiling for an unrelated issue before, and noting that the progress bar updates alone took a significant portion of CPU for a small render (something like 1s out of a 3s preview). I had mentioned it in this issue, with corresponding flame chart: #2303 Maybe something about @cebderby's combination of desktop environment, hardware or drivers are particularly slow at redrawing progress bar widget which exacerbates this issue. Regardless I think there should be some mechanism to throttle the progress bar update calls per second to say 60 or 30fps, by putting the update calls inside a QTimer set to that interval, and only redrawing if progress changed since last interval. Because doing 1000 updates every time is a bit excessive. I thought about it some but never got around to writing up a solution. |
Just changing the redraw will not help, commenting out the updateEvents call will cause the progress bar to never render, but it does not save any time. I guess the only way is to throttle at the source, not at the end of the call chain. |
Thanks for the efforts/thinking on this. Yes, not repainting the main model view 1000? num elements? times could be the problem and answer. Suspending the repaints during the F5 processing would feel ok to me, then the old view of the model is definitely still there until the new view replaces it, as happens by chance at the moment if the F5 processing finishes before any CPU is (made) available to show the progress bar at all. |
I implemented a throttle on the progress bar that I was thinking about. Using @MichaelPFrey's example code the preview time went from 15s to 4s for me. |
I get 2s now with #2738 Edit: hmm, actually I get 2s I guess just from the change to 5 updates / sec apparently. |
Just tried the latest nightly (2019.01.30.nightly git f914a57) and getting the 1s/2s preview with the test cases and same with a very complex actual model. Only by turning all parts of that on - something I don't normally do - could I get the briefest flash of the progress bar, and that immediately gone, so this is nice. For the time being, I have been running a self-compiled copy with the progress bar call (for the preview) disabled. I found that, in MainWindow::compileCSG(), there's a call with the report_prep function passed as the 2nd parameter, which I tried changing to nullptr. This was either going to cause a seg fault or not invoke the status bar, and it seems to be absolutely fine. For any models that are ever going to be feasible for F6 rendering (ie 3 or 4 orders of magnitude smaller), the preview status bar is never seen anyway, and anyone with very large model is likely going to be happy with never seeing it, with the flash of cleared screen that goes with it. It's good if there are possibilities of making the preview itself more efficient, but completely disabling the progress bar for preview as above seems best for me. |
I can get preview bars lasting for 10 minutes or more during my first F5 because I have lots of renders, so I don't want it disabled completely. How can 5 progress bar draws a second slow anything down? |
10 mins of F5? ouch! Then the current nightly is probably optimal. |
I had been using the Nightly as the last prod release was (presumably still is as no re-release) flickering badly with a very large model. However, during this year I've found Preview mode very slow, and have been ignoring the Nightly and using a 2018.02 AppImage I happened to have downloaded to try. This version has 2 advantages - fast Preview and double-click to set view focus (rotation, zoom centre). A later AppImage from 2018.04 is much more like the current Nightly.
For comparison, for models above a certain complexity, Preview rendering time is 4s for 2018.02 against an unpleasant/unusable 36s for Nightly. If it matters I'm using Mint 18.3 MATE 64bit.
I've been able to reproduce the problem with a trivial .scad file, in which the complexity can be changed by altering a single value, and a loop then generates some arbitrary geometry. Hopefully this works for others, the numbers may be different depending on CPU speed etc I guess. See attached.
progress_bar_36s_preview_time.scad.txt
My conclusion is that with the 2018.02 version, rendering time was up to 1s for the model plus up to 3s for the progress bar. And that for the current nightly, the same models take up to 2s for the model plus up to ~35s for the progress bar. (The model rendering time probably scaling linearly with complexity, the progress bar time linearly with the amount of time or fraction it is displayed).
Clearly having the progress bar take 3x (old) up to 15x (latest) the actual activity needs addressing, however my recommendation is that the progress bar is never shown for Preview, it's just too fast without! Presumably the progress bar for Render needs to be checked, in case it's wasting time there too.
Don't know why the newer version takes 2s rather than 1s for a big model, but that's secondary to the main issue.
If possible, it would be good if the old view is cleared from the screen as late as possible, so the new preview just appears directly after it, without a 'flash' of cleared screen between. That way the effect of tweaking a value and re-Preview can be seen the best.
I'd also love to see the return of double-click to set view focus too, if that's still possible (or ctrl-click or anything similar if there's a problem with double-click).
The text was updated successfully, but these errors were encountered: