sophos
V2EX  ›  编程

Rust vs Go,性能差距确实不小,重写 httpmq 有感

  •  2
     
  •   sophos · Jan 4, 2022 · 2814 views
    This topic created in 1616 days ago, the information mentioned may be changed or developed.

    元旦三天在家玩了下 Rust ,尝试重新实现了 httpmq
    对比了下几年前的 Go 代码实现,性能提升接近 1 倍

    Rust 用起来还是没有 Go 顺手,总感觉思维有点被编译器限制了
    不过能让初学者就能写出内存安全且性能不错的代码,这比 C/C++ 要强不少

    对比 GO ,Rust 的主要优势在于和 C/C++ 无损调用,值得继续学习

    https://github.com/hnlq715/httpmq-rs#benchmark
    https://github.com/hnlq715/httpmq#benchmark

    5 replies    2022-07-26 22:11:09 +08:00
    darksword21
        1
    darksword21  
    PRO
       Jan 4, 2022 via iPhone
    用了三天就开始对比…
    sophos
        2
    sophos  
    OP
       Jan 4, 2022 via iPhone   ❤️ 1
    @darksword21 看 rust 开源代码有半年多了,哈哈哈
    zizon
        3
    zizon  
       Jan 4, 2022
    一个是 leveldb,一个是 rocksdb?
    sophos
        4
    sophos  
    OP
       Jan 4, 2022
    @zizon 嗯,rust 之前是用 leveldb 的实现,后面换成 rocksdb 了,差别不大
    vfs
        5
    vfs  
       Jul 26, 2022
    其实个人建议如果说性能的时候,尽量数据,环境,测试 case 都提一下,要不然直接上来提升一倍,很难让人接收
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3242 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 67ms · UTC 12:08 · PVG 20:08 · LAX 05:08 · JFK 08:08
    ♥ Do have faith in what you're doing.