-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Right now plot requests are handled at idle time when no user executions are running in the console:
ark/crates/ark/src/interface.rs
Line 842 in 40908a3
unsafe { Self::process_idle_events() }; |
The current way we poll for the messages is timeout-based, with a freq of 200ms at the time of writing. This approach translates to visible delays in the frontend when a plot needs to be rerendered. I'm about to reduce the frequency to 50ms but ideally we wouldn't wait at all when a request is ready.
To fix this, we could spawn an async idle task with r_task::spawn_idle()
that runs an infinite loop selecting on the plot comm channels. This would involve:
- Switching to tokio async channels instead of sync crossbeam channels.
- Setting things up so that
is_drawing
andshould_render
causes the task to wait until the graphics device is ready to render.
This approach will improve overall performance of the communication between the frontend and Ark for plots (part of posit-dev/positron#5184).