Comments (5)
@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.
from rx.
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.
from rx.
@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.
from rx.
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.
from rx.
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?
from rx.
Related Issues (17)
- subscribeOn is broken with TaskPoolScheduler and ThreadScheduler HOT 4
- Implement groupBy HOT 7
- Rename AnonymouseDisposable to AnonymousDisposable
- Observer not triggered HOT 7
- Commented examples / Basic Docs HOT 6
- Thread model questions HOT 7
- Return type of filter!(...) HOT 3
- Filter subscribers HOT 27
- CompositeObserver / several times the same observer HOT 1
- CompositeObserver.remove() returning Observer? HOT 3
- Why three different makeObserver(...) functions instead of one? HOT 1
- How to get reference to underlying object/function of an observer? HOT 1
- makeObserver in a loop / why does it use static struct? HOT 2
- RX fails with DMD 2.089 HOT 5
- Compile error from v0.11.0 on / .filter() / casts give different sizes error HOT 8
- Observable pipeline question
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rx.