Giter Site home page Giter Site logo

Speed of message distribution? about rx HOT 5 OPEN

lempiji avatar lempiji commented on May 15, 2024
Speed of message distribution?

from rx.

Comments (5)

Robert-M-Muench avatar Robert-M-Muench commented on May 15, 2024

@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.

lempiji avatar lempiji commented on May 15, 2024

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.

lempiji avatar lempiji commented on May 15, 2024

@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.

Robert-M-Muench avatar Robert-M-Muench commented on May 15, 2024

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.

Robert-M-Muench avatar Robert-M-Muench commented on May 15, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.