sophos
V2EX  ›  编程

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

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