"vscode:/vscode.git/clone" did not exist on "78644cdf4407f8f9215939f486394b3a4285915f"
Commit af8ee9db authored by Alexander Zaitsev's avatar Alexander Zaitsev Committed by GitHub
Browse files

feat: enable LTO and codegen-units = 1 optimizations (#279)

#### Overview:

This PR enables more aggressive compiler optimizations for the project which should lead to better performance and smaller binary sizes.

In this PR, I decided to use Fat LTO instead of ThinLTO since it provides higher optimization level.

I have made quick tests (AMD Ryzen 5900x, Fedora 41, Rust 1.85.1, the latest version of the project at the moment, `cargo build --release` command) - here are the results about the binary size improvements.

| Binary\Build mode | dynamo-run | libdynamo_llm_capi.so | http | llmctl | metrics | mock_worker |
| --- | --- | --- | --- | --- | --- | --- |
| Release | 55 Mib | 14 Mib | 19 Mib | 14 Mib | 21 Mib | 14 Mib |
| Release + `codegen-units = 1` + ThinLTO | 43 Mib | 11 Mib | 15 Mib | 11 Mib | 17 Mib | 11 Mib |
| Release + `codegen-units = 1` + FatLTO | 38 Mib | 9.2 Mib | 13 Mib | 9.6 Mib | 15 Mib | 9.6 Mib |

#### Details:

Enable `codegen-units = 1` and Fat LTO for better optimizations.

#### Where should the reviewer start?

Just check the `Cargo.toml` file ;)

#### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

- closes GitHub issue: #278 
parent fd95f37b
...@@ -66,3 +66,7 @@ prometheus = { version = "0.13" } ...@@ -66,3 +66,7 @@ prometheus = { version = "0.13" }
[profile.dev.package] [profile.dev.package]
insta.opt-level = 3 insta.opt-level = 3
[profile.release]
codegen-units = 1
lto = true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment