-
Notifications
You must be signed in to change notification settings - Fork 206
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
Pattern for avoiding clogging / backpressure #394
Comments
Hello @monfera, thanks for the issue. Deciding anything related to timing is a difficult problem and it can be even more difficult when it comes to rendering. Its difficult to give a blanket answer to that, as it really depends on so many different things. As for emitting values on
This is 100% on purpose. We would like to promote declarative uses of reactive streams over imperative solutions. |
If you must emit events imperatively, the following two packages are an option: |
@TylorS @axefrog thank you for the suggestions, I gave it a shot, based on the primitives in your link, rendering was nicely triggered by As you implied,
naturally it underutilizes resources as it only triggers a render when the 16.7ms frame length, 60FPS cadence resumes, but good 1st experiment. Still, the above mentioned deterioration remained, which might be because while If there's a pattern for 'render on each |
@TylorS @axefrog ... on a second thought, perhaps armed with
|
Think of a timer stream generated by
most.periodic
and consumed by amost.observe
that e.g. renders something on the canvas. This naive approach led to either of these two things, or both:I think the average rendering time is a bit above 30ms, of course, depending on hardware and amount of data shown and non-deterministic HW drivers etc., i.e. I can't fully control the per-frame or aggregate rendering time.
Would a better approach use a
rAF
loop to emit signals? Also, as there seems to be no dedicated API notion for manually emitting an event (unlike in e.g. flyd where you can call the stream as a function with a value), perhaps the best option is something like the promise based iterate except usingrAF
instead ofsetTimeout
?The text was updated successfully, but these errors were encountered: