Replies: 1 comment 1 reply
-
Hi @yrashk, To release event pressure, FTXUI only draw a new frame after it has consumed every pending events: void ScreenInteractive::RunOnce(Component component) {
Task task;
while (task_receiver_->ReceiveNonBlocking(&task)) {
HandleTask(component, task);
ExecuteSignalHandlers();
}
Draw(std::move(component));
} It means FTXUI is always going to be able to adapt, even if you send 10000 events per seconds. You can try this demo: Of course this works only if "handling one event" is sufficiently fast. If you only want to flag the current frame as "dirty" and do not need to propagate the event inside deeply nested UI, you might want to try: void ScreenInteractive::RequestAnimationFrame(); instead? Do you think this address your request? |
Beta Was this translation helpful? Give feedback.
-
I have a fairly specific case where I am trying to use an FTXUI component to render a fast-moving log stream. Whenever a new record arrives, a thread will post a Custom event. That would trigger the re-rendering, which is, I believe, at times of high volume streaming excessively unnecessary for the following reasons:
OnEvent
is called after a few events are posted.Since the producer doesn't know where the component is regarding catching up, it is difficult to control this pressure on the producer's side.
So I was thinking about options here.
One option is to encode somehow when an event of a certain type (see a link to another discussion below) is no longer of interest. But that's difficult; it forces us to carefully design complex custom events and event expiration. It may also depend on the consumer's point of view when the event actually expires.
Another (perhaps simpler?) option is to denote some events as debouncable; if it is produced more than once while there is another message of the same type, it is dropped. It still likely requires a way to introduce tagged events of a sort (see #677) just so that they can be separated from others. Thinking in the context of #677, what if it not only had a
tag
but adebounce
flag?Any thoughts?
This is tangentially related to #676
Beta Was this translation helpful? Give feedback.
All reactions