Coder Social home page Coder Social logo

Comments (8)

msparkles avatar msparkles commented on May 12, 2024 1

Got it :) We might work on it when we have time and motivation!

from ractor.

slawlor avatar slawlor commented on May 12, 2024

Couldn't you use the existing multi_call and give an array of the same actor? Wouldn't that achieve the same result here?

I think there's definitely a use-case for having a MultiReplyPort or something, so instead of a single result, you could get a stream of results for example. But normally that's not something present in Erlang's OTP, and we'd probably build a different pattern for it when needed. As an example, send a cast with an argument of the reply actor, and then the caller sends N messages back to the caller. But it won't block the same way as an RPC.

from ractor.

msparkles avatar msparkles commented on May 12, 2024

We transitioned from Riker-rs to ractor just now. We made this code because in riker, calling the actor a bunch of times and getting the results (internally via a lot of Oneshot's, just like ractor) was slow, so we made one that utilizes a mpsc channel to make it faster. (And it did improve efficiency there!)

We're not certain that this approach would necessarily be faster in ractor, but generally mpsc seems to fit better than creating a lot of oneshot's for when you have multiple messages with each a response.

Maybe we could make a benchmark, hm.

from ractor.

msparkles avatar msparkles commented on May 12, 2024

And also, we're not sure if multi_call would help here, since the messages are different.

from ractor.

slawlor avatar slawlor commented on May 12, 2024

How would you have a mpsc reply port if the input messages are different, therefore likely resulting in different reply types? Unless you have each message have the same return type, which then is quite flaky to provide something at a framework level, I don't see how you could make this work.

We could add a multiple-reply port, but I don't see a strong reason to do it yet (personally).

from ractor.

msparkles avatar msparkles commented on May 12, 2024

The messages are different as in they each have different parameters, specifically different parameters in an Enum.

The replies are the same way, different parameters in the same type as other replies.

We meant that the message values are different, not the types, sorry for the confusion.

from ractor.

msparkles avatar msparkles commented on May 12, 2024

The messages also have the same enum kind, they're all the same kind just different parameters.

from ractor.

slawlor avatar slawlor commented on May 12, 2024

We're not certain that this approach would necessarily be faster in ractor, but generally mpsc seems to fit better than creating a lot of oneshot's for when you have multiple messages with each a response.

From my point of view, this would be the only reason to add what you're requesting here. It would require a decent amount of support changes in the proc macros of ractor_cluster I think, so i'm hesitant to do it. If you however wish to put up a PR of what it might look like I'm open to considering it! Thanks :)

from ractor.

Related Issues (20)

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.