Skip to content
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

Shape processing is blocking event loop #1327

Closed
hannobraun opened this issue Nov 9, 2022 · 0 comments · Fixed by #1476
Closed

Shape processing is blocking event loop #1327

hannobraun opened this issue Nov 9, 2022 · 0 comments · Fixed by #1476
Labels
type: bug Something isn't working

Comments

@hannobraun
Copy link
Owner

When the Fornjot app loads a model, there are multiple steps to that:

  1. The app determines that it needs to load the model, either because it detected a change in the model, or because this is the initial load.
  2. The app starts compiling the model.
  3. Once the model has been compiled, the app starts processing the model. This means it is evaluated, kernel data structures are built, and a triangle mesh (for rendering) is created.

This last step happens within the main event loop, which blocks the UI while that is going on. See this screenshot:
Screenshot from 2022-11-09 10-53-53

Those last two status messages have a clear difference in their timestamp, yet they show up in the UI at the same instant. The UI can't show the first one any earlier, because the main event loop is blocked.

The main event loop is located in fj-window and uses winit. Winit has a mechanism for passing outside events into the event loop, and I believe we should use that to do any non-UI work outside of the event loop and just pass the results in. I already looked into that, but unfortunately it is not a trivial change. The problem is, that the code operating outside of the event loop would need access to Host, but the host variable is mutable and updated from within the event loop, based on UI events.

We need to rethink the interaction between the event loop and Host to make this work. Either by making Host smarter, so it can handle no model being available and can react to a model being loaded, or by creating some kind of proxy between the event loop and Host that handles that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
1 participant