Giter Club home page Giter Club logo

nuts's People

Contributors

fadedbee avatar jakmeier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nuts's Issues

Investigation: Multi-threaded dispatch

Right now, nuts only works in a single thread. All data is stored in the thread-local storage object NUT. If there are multiple threads (non-web) then there will be multiple such nuts that are completely oblivious of each other.

The idea to be captured by this issue is that there could be multiple nuts that communicate with each other and the work split between them. Activities in different domains could live in different nuts. Messages would be forwarded to all nuts, but the state stored in domains could be kept in a single nut (= single thread).

Once this works on a non-web target, the feature can be extended to work on the web too, using web workers that communicate with the browser API's message passing. This would allow to have easy multi-threading in WASM, even without browser support for SharedArrayBuffer and WebAssembly threads.

Subscribe without activity

Idea:

Allow subscriptions without an activity.

Current Status

With the current API, a subscription can only be created on an activity. This sometimes forces programmers to create a dummy activity to react on a specific message.

Example:

  let dummy = nuts::new_activity(());
  dummy.subscribe(|_: &mut(), msg: &Message| { /*...*/ });

Possible new syntax

  nuts::subscribe(|msg: &Message| { /*...*/ });

Also feasible to add:

  nuts::subscribe_domained(&MyDomain::DomainA, |domain, msg: &Message| { /*...*/ });

Investigation: Use native event loop on the web

Nuts sequentially schedules jobs that are activated by published messages. It is essentially implementing an event loop.

When Nuts is used in the browser, it could potentially use the postMessage() function to schedule tasks on the native event loop.

Before merging a potential implementation, it would be good to assess the performance and size difference.

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.