Skip to content

Performance Optimization Tips

Yu Ding edited this page May 12, 2019 · 2 revisions

Performance Optimization Tips

Enable link time optimization

This could boost CPU-intensive enclaves about 2~5% (on my 9900K)

In Cargo.toml:

[profile.release]
lto = true

Let rustc emit asm

This could boost enclaves on some platforms.

Set an environment variable as

export RUSTFLAGS="--emit asm"

Or create a .cargo/config which covers your project as:

[build]
rustflags = ["--emit","asm"]

Configure target_cpu for llvm

This could boost enclaves on some platforms (not effective on my 9900K).

Set an environment variable as

export RUSTFLAGS="-C target-cpu=native"

Or create a .cargo/config which covers your project as:

[build]
rustflags = ["-C", "target-cpu=native"]

Enable lto on the final linking step

Add -flto to the final linking step using CXX.