簡體   English   中英

Rust:與配備 Core i7 的 MacOS 相比,配備 Core i9 的 Ubuntu 運行時性能較差

[英]Rust: Poor runtime performance on Ubuntu with Core i9 compared to MacOS with Core i7

在測量 Rust 二進制包的運行時性能時,我遇到了一個奇怪的問題。 板條箱是xdevs 模擬器 要運行它,您只需要克隆 git 存儲庫:

git clone https://github.com/iscar-ucm/xdevs.rs.git
cd xdevs.rs
cargo run --release HO 200 200

在裝有 MacOS Moterey 和 2.5 GHz 四核 Intel Core i7 處理器的 MacBook Pro 上,我得到這個 output:

Model creation time: 110.71127ms
Simulator creation time: 121ns
Simulation time: 991.374624ms

但是,當嘗試使用 Ubuntu 20.04 和 Intel Core i9-10900X CPU @ 3.70GHz 的工作站 PC 時,我得到這個 output:

Model creation time: 61.938331ms
Simulator creation time: 137ns
Simulation time: 2.737863127s

這對我來說毫無意義。 為什么我使用更強大的機器得到更差的結果? 順便說一下,我正在啟用鏈接時間優化並在編譯時使用 target-cpu=native 標志。

我想也許兩個平台的調試模式優化不同,您是否嘗試過cargo --release在發布模式下構建。


抱歉,我沒有注意到--release ,我在我的筆記本上試了一下( archlinux ryzen 4800U ):

[I] forks@archlinux /t/xdevs.rs (main)> target/release/xdevs HO 200 200
Model creation time: 67.439928ms
Simulator creation time: 1.396µs
Simulation time: 2.061134191s

在我的 PC ( archlinux ryzen 1700x ) 上得到類似的結果:

*[main][/tmp/xdevs.rs]$ target/release/xdevs HO 200 200
Model creation time: 89.505405ms
Simulator creation time: 80ns
Simulation time: 2.039591205s

工具鏈? cpu調度? 我試過HO 200 2000

[I] forks@archlinux /t/xdevs.rs (main)> time target/release/xdevs HO 200 2000
Model creation time: 606.153956ms
Simulator creation time: 1.467µs
Simulation time: 21.079952693s

*[main][/tmp/xdevs.rs]$ target/release/xdevs HO 200 2000
Model creation time: 685.050164ms
Simulator creation time: 40ns
Simulation time: 21.746809784s

相同的結果

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM