首页
学习
活动
专区
圈层
工具
发布
    • 综合排序
    • 最热优先
    • 最新优先
    时间不限
  • 来自专栏欢迎加入非凸科技

    Rust异步框架的性能评估

    Zenoh是一个基于async_std的异步零开销发布/订阅、存储/查询和计算框架,Zenoh是用Rust编写的,它利用异步特性来实现高性能和可扩展性。 Zenoh官方评估了三个异步框架(async_std/Tokio/smol)在异步网络上的性能。对每一种方法进行评估,并与Rust标准库提供的等效同步原语提供的基线性能进行比较。 评估显示,async_std和smol非常接近标准库,并且在某些工作负载上优于标准库。另一方面,Tokio似乎很快就达到了它的极限,即100 msg/s时达到18µs,并且TCP和UDP之间没有差异。 基于这些结果,Zenoh认为他们别无选择,只能继续使用async_std。也就是说,了解Tokio为什么会在比较中暴露这种行为,并改善其原始性能以缩小与async_std的差距,这将是一件有趣的事。

    1.2K20编辑于 2022-04-22
  • 来自专栏Rust语言学习交流

    【Rust日报】2020-04-24 Tide 0.8.0 發佈了!

    新特色 Fallible endpoints use async_std::{fs, io}; use tide::{Response, StatusCode}; #[async_std::main ; Ok(()) } 新特色 Server-Sent Events use tide::sse; #[async_std::main] async fn main() -> Result<( ; Ok(()) } 新特色 Static file serving #[async_std::main] async fn main() -> Result<(), std::io::Error

    51410发布于 2020-04-27
  • 来自专栏Rust语言学习交流

    【Rust日报】 2019-12-21 bumpalo v3.0.0,async-std v1.4.0

    use async_std::prelude::*; use async_std::future; use std::time::Duration; let fut = future::pending

    74330发布于 2019-12-25
  • 来自专栏Rust语言学习交流

    【Rust日报】2022-04-19 Rust异步框架的性能评估

    Rust异步框架的性能评估 A Performance Evaluation on Rust Asynchronous Frameworks Zenoh (发音:/zeno/)是一个基于async_std 的异步零开销发布/订阅、存储/查询和计算框架,Zenoh是用Rust编写的,它利用异步特性来实现高性能和可扩展性; 在这篇博客中,Zenoh官方评估了三个异步框架(async_std/Tokio/smol 评估显示,async_std和smol非常接近标准库,并且在某些工作负载上优于标准库。另一方面,Tokio似乎很快就达到了它的极限,即100 msg/s时达到18µs,并且TCP和UDP之间没有差异。 基于这些结果,Zenoh认为他们别无选择,只能继续使用async_std。也就是说,了解Tokio为什么会在比较中暴露这种行为,并改善其原始性能以缩小与async_std的差距,这将是一件有趣的事。

    83930编辑于 2022-06-10
  • 来自专栏Rust语言学习交流

    【Rust每周“一”库】async http三剑客

    ::io::prelude::*; use async_std::net::TcpStream; use http_types::{Method, Request, Url}; #[async_std , res); Ok(()) } 而一个异步的http服务器则不超过30行代码(而且import,循环,print等还占据了绝大部分代码) use async_std::net::{TcpStream , TcpListener}; use async_std::prelude::*; use async_std::task; use http_types::{Response, StatusCode ; Ok(()) } 而只需要再加几行代码就能实现一个加密的版本:读取证书,并把用它往接受到的stream外包一层 use async_std::prelude::*; use async_std ::net::TcpListener; use async_std::fs::File; let key = File::open("identity.pfx").await?

    99510发布于 2020-03-10
  • 来自专栏Rust语言学习交流

    【Rust日报】2021-01-16 Async-std v1.9.0 发布

    博客文章链接,https://deno.land/posts/deno-in-2020 Release Async-std v1.9.0 发布 这个版本发布了稳定的 async_std::channel use async_std::channel; let (sender, receiver) = channel::unbounded(); assert_eq!

    1K20发布于 2021-01-21
  • 来自专栏Rust语言学习交流

    再谈 Send 与 Sync | Rust学习笔记

    ) {} async fn run_mut(&mut self) {} } fn test2<T: Send + 'static>(mut aa: AA<T>) { let ha = async_std 代码如下: fn test2<T: Send + 'static>(mut aa: AA<T>) { let ha = async_std::task::spawn(async move { fn test2<T: Send + Sync + 'static>(mut aa: AA<T>) { let ha = async_std::task::spawn(async move { 值得指出的是上述代码中调用 AA::run_mut(&mut self) 不需要 Sync 标记: fn test2<T: Send + 'static>(mut aa: AA<T>) { let ha = async_std

    1.8K30发布于 2020-11-06
  • 来自专栏InCerry

    2024年各编程语言运行100万个并发任务需要多少内存?

    tasks.push(sleep(Duration::from_secs(10))); } futures::future::join_all(tasks).await; } 而另一个使用async_std : use std::env; use async_std::task; use futures::future::join_all; use std::time::Duration; #[async_std

    43510编辑于 2024-11-29
  • 来自专栏Rust语言学习交流

    【Rust日报】2022-04-24 redb:嵌入式DB

    github.com/cberner/redb/blob/master/docs/design.md GitHub:https://github.com/cberner/redb Rust异步框架评测 主要对 async_std 结论如下: async_std 和 smol 非常接近标准库,并在某些负载上更优。 Tokio 似乎受到 CPU-bound(Rust)异步任务的不利影响。 async_std:https://async.rs/ Tokio:https://tokio.rs/ smol:https://github.com/smol-rs/smol 文章链接:https:/

    92920编辑于 2022-06-10
  • 来自专栏菠萝上市没有

    libp2p之mdns简单使用

    FileResponse>, // 数据传输 keep_live: libp2p::swarm::keep_alive::Behaviour, // 心跳 } #[async_std .multiplex(yamux::Config::default()) .boxed(); let quic_transport = quic::async_std

    81430编辑于 2023-09-28
  • 来自专栏TensorFlow从0到N + Rust

    【译文】Rust futures: async fn中的thread::sleep和阻塞调用

    你可以找到一个异步替代方案:当thread::sleep阻塞时,你可以使用它们(取决于你选择的运行时生态系统): async_std::task::sleep (1.0) tokio::time::delay_for (0.2.0) tokio和async_std都为其他阻塞操作(例如文件系统和tcp流访问)提供了异步替代方法。 tokio::task::spawn_blocking (0.2.0) async_std::task::spawn_blocking (1.0) 这要求你的运行时具有专用于卸载阻塞调用的机制(例如线程池

    3.4K20发布于 2020-10-10
  • 来自专栏Rust语言学习交流

    【Rust每周一知】Rust 异步入门

    使用async-std的文件IO 我们唯一要做的更改是将我们的std导入替换为async_std。 对于以下示例,我们使用crate async-std版本1.5.0。 // async-example/src/file.rs // We use async_std instead of std, it's that simple. use async_std::io ; use async_std::fs::File; use async_std::prelude::*; pub async fn read_file(path: &str) -> io::Result

    2.1K10发布于 2020-02-24
  • 来自专栏Rust语言学习交流

    【Rust日报】 2019-09-27:async-std v0.99.7 released

    reference to the field } } Read more async-std v0.99.7 released 增加了16個新的api example future::join use async_std

    74220发布于 2019-09-29
  • 来自专栏Rust语言学习交流

    【Rust日报】 2019-10-29 async-std v0.99.11 发布

    了解更多 async-std v0.99.11 发布 async_std 团队度假回来了,然后就发布了这个船新版本。

    66230发布于 2019-10-31
  • 来自专栏Rust语言学习交流

    「官方」async_await将在Rust 1.39稳定版中发布

    Read More: https://github.com/rust-lang/rust/pull/63209#issuecomment-523113079 宣告:async-std 异步标准库的测试版 #async_std async.rs/blog/announcing-async-std/ Book: https://book.async.rs/ Docs: https://docs.rs/async-std/0.99.3/async_std

    1.9K10发布于 2019-08-23
  • 来自专栏DotNet NB && CloudNative

    2024年各编程语言运行100万个并发任务需要多少内存?

    tasks.push(sleep(Duration::from_secs(10))); } futures::future::join_all(tasks).await; } 而另一个使用async_std : use std::env; use async_std::task; use futures::future::join_all; use std::time::Duration; #[async_std

    35810编辑于 2025-01-03
  • 来自专栏Rust语言学习交流

    【Rust日报】2020-02-15 Roa,异步web框架

    attributes"] } // main.rs use roa::core::App; use roa::preload::*; use std::error::Error as StdError; #[async_std

    68720发布于 2020-02-20
  • Rust 中将 markdown 渲染为 html

    markdown.rs markdown.rs 使用非常简单: use markdown; // 如果您没有异步库 async-std 依赖项, // 请替换下述前 2 行代码为 // fn main() { #[async_std use markdown; use std::path::Path; // 如果您没有异步库 async-std 依赖项, // 请替换下述前 2 行代码为 // fn main() { #[async_std

    2.4K10编辑于 2022-06-30
  • 来自专栏Rust语言学习交流

    【Rust日报】2020-02-06 那些在生产中使用 Rust 的公司

    { users (id) { id -> Uuid, } } #[async_std::main] async fn main() -> Result<(), Box<

    71410发布于 2020-02-20
  • 构建基于 Rust 技术栈的 GraphQL 服务(2)- 查询服务第一部分

    /backend/src 目录,迭代 main.rs 文件: mod gql; use crate::gql::{build_schema, graphiql, graphql}; #[async_std cargo watch -x "run" 但遗憾的是——此时,你会发现服务器无法启动,因为上面的代码中,我们使用了 #[async_std::main] 此类的 Rust 属性标记。

    1.3K20编辑于 2022-06-30
领券