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

Speed of message distribution? #27

Open
Robert-M-Muench opened this issue May 19, 2018 · 5 comments
Open

Speed of message distribution? #27

Robert-M-Muench opened this issue May 19, 2018 · 5 comments

Comments

@Robert-M-Muench
Copy link

Let's assume I have many steams (500) & observables (10000). The steams filter a couple of external message streams into more specific ones. How does rx scale? Are there are some optimizations to only call the necessary streams/observables that are involved?

I'm wondering where the limit of such a framework is, when it just takes to long to route messages etc. around.

@Robert-M-Muench
Copy link
Author

@lempiji Coming back to this one. Did you run any benchmarks of rx? I really would like to see those... but I'm not sure if I'm knowledgeable enough to come up with a good one.

@lempiji
Copy link
Owner

lempiji commented Feb 25, 2019

OK. I will try to compare the many filtered Observable with the simply switch-case version.

However, when looking at usage examples such as rxjs, it is used to handle one kind of event such as click.
Using filters and Observable as a method of classify and dispatching messages may be expensive.

lempiji added a commit that referenced this issue Feb 27, 2019
@lempiji
Copy link
Owner

lempiji commented Feb 27, 2019

@Robert-M-Muench I wrote a benchmark.
https://github.com/lempiji/rx/blob/dev/benchmarks/subject-put/source/app.d

The result of a simple method was much slower than expected, so I thought about a faster way.

A simple filter-subscribe model is slow, because the number of Observers to put is large.
Observer is internally managed as an array, which takes time to process linear orders.

In particular, it is important not to subscribe a lot to one Subject.
For this, you should split the SubjectObject moderately.

By the way, though I thought about writing with switch-case, I gave up because it was difficult to generate code.

@Robert-M-Muench
Copy link
Author

Thanks for the benchmark, great stuff to learn RX better.

What I want to do with RX is, to use one stream for Windows messages to my app and split them into different streams (like a mouse-click-stream, windows-resize stream, etc.) so that any component subscribes to the messages it's interested in.

@Robert-M-Muench
Copy link
Author

Using the array approach now, which works great. I think this is a generic pattern and might be added/integrated to RX as a new observable type? Maybe something like an observable array/group that uses this approach internally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants