Performance when using dozens of Observable.Sample() instances? (question)
- Dominant language
- C#
- Stars
- 7.2k
- Forks
- 798
- PR merge metrics
- No merged PRs in 30d
Description
tl;dr if I have 100 observer instances, each using .Sample(), will this cause a performance issue? And any better or worse than using 100 System.Threading.Timers?
Within my WPF application there is an event being raised (potentially) tens of times per second (originating from an external device). A class subscribes to this event and forwards the event args to the Process() method of one of (up to) 100 "processor" objects. An event arg property value is used to determine which instance the event gets passed to.
What the Process() method does is irrelevant, but each processor instance needs to throttle how often its method processes such an event. Each processor instance will use one of the following time intervals: 1 sec, 1 min, 1 hour, 1 day, or 1 week.
Originally I was going to implement throttling using System.Threading.Timer but was concerned that having 100 timers running may cause performance issues. I then started thinking about Rx's Observable.Sample() instead, which would result in much cleaner code. Are there any performance risks in using so many instances? I'm assuming that Observable.Sample() still uses a timer under the covers to achieve throttling?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.