From 7502011e98dd7e114eb951b61fefacf1b3bea06c Mon Sep 17 00:00:00 2001 From: VirxEC Date: Mon, 3 Jun 2024 00:09:25 -0400 Subject: [PATCH] Enable thin lto Ensure opt-level is 3 --- Cargo.toml | 4 +++- build.rs | 2 ++ examples/real_bench.rs | 2 +- examples/thread_bench.rs | 4 +--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fb78d0e..e4192ae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rocketsim_rs" description = "Rust bindings for the RocketSim project" -version = "0.30.0" +version = "0.30.1" edition = "2021" license = "MIT" repository = "https://github.com/VirxEC/rocketsim-rs" @@ -21,6 +21,8 @@ cxx-build = "1.0.122" [profile.release] lto = true +codegen-units = 1 +panic = "abort" [features] default = ["debug_logging", "bin"] diff --git a/build.rs b/build.rs index a3da452..76c5a9c 100644 --- a/build.rs +++ b/build.rs @@ -32,6 +32,8 @@ fn main() { if !cfg!(debug_assertions) { builder.define("RS_MAX_SPEED", "1"); + builder.flag_if_supported("-flto=thin"); + builder.opt_level_str("3"); } builder diff --git a/examples/real_bench.rs b/examples/real_bench.rs index 8abc453..cc4e886 100644 --- a/examples/real_bench.rs +++ b/examples/real_bench.rs @@ -5,7 +5,7 @@ use std::{ }; fn main() { - const TICKS: u32 = 50000; + const TICKS: u32 = 200_000; // load in assets rocketsim_rs::init(None); diff --git a/examples/thread_bench.rs b/examples/thread_bench.rs index be39f42..725e55f 100644 --- a/examples/thread_bench.rs +++ b/examples/thread_bench.rs @@ -2,18 +2,16 @@ use rocketsim_rs::sim::{Arena, CarConfig, Team}; use std::time::Instant; fn main() { - const TICKS: u32 = 250_000; + const TICKS: u32 = 1_000_000; // load in assets rocketsim_rs::init(None); let mut arena = Arena::default_standard(); - let _ = arena.pin_mut().add_car(Team::Blue, CarConfig::octane()); let _ = arena.pin_mut().add_car(Team::Blue, CarConfig::octane()); let _ = arena.pin_mut().add_car(Team::Blue, CarConfig::octane()); - let _ = arena.pin_mut().add_car(Team::Orange, CarConfig::octane()); let _ = arena.pin_mut().add_car(Team::Orange, CarConfig::octane()); let _ = arena.pin_mut().add_car(Team::Orange, CarConfig::octane());