Skip to content

Question for using std rust channel instead of tokio's channel in async_policy of reinforcement learning #4558

@seongs1024

Description

@seongs1024

Feature description

burn has already had the dependency, tokio, which is efficient for task scheduling.

burn/Cargo.toml

Lines 110 to 112 in 5923b1e

tokio = { version = "1.49.0", features = ["rt", "macros"] }
tokio-tungstenite = "0.28"
tokio-util = "0.7"

But async_policy use std rust channel.

use std::{
sync::{
Arc,
atomic::{AtomicUsize, Ordering},
mpsc::{self, Sender},
},
thread::spawn,
};

I guess, reasons for this are:

  1. To avoid context switching overhead
  2. Not necessary because messages are processed in a dedicated thread
  3. To avoid function coloring

If so, crossbeam may be a candidate for better performance.

Feature motivation

(Optional) Suggest a Solution

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions