From 74c28c9344d1cbc0a2202ac2f29e85af679781e5 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Sat, 6 Dec 2025 13:51:45 -0500 Subject: [PATCH] Performance optimization settings & switch to nightly rust --- .cargo/config.toml | 2 ++ Cargo.toml | 6 ++++++ README.md | 10 +++++----- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..ddff440 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags = ["-C", "target-cpu=native"] diff --git a/Cargo.toml b/Cargo.toml index 3626dc9..1d52ac6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,12 @@ test-log = { version = "0.2", default-features = false, features = ["trace"] } [profile.dev.package.backtrace] opt-level = 3 +# Gotta go fast +[profile.release] +codegen-units = 1 +lto = "fat" +panic = "abort" + [lib] name = "aoc" path = "src/lib.rs" diff --git a/README.md b/README.md index e30d754..080c607 100644 --- a/README.md +++ b/README.md @@ -26,13 +26,13 @@ To run benchmarks: `cargo bench`. Or a specific day and/or part: `cargo bench -- ### Results -These were all run on my personal machine, an AMD Ryzen 9 3900X 12-Core Processor with 32 GB RAM, on Linux (WSL). +These were all run on my personal machine, an AMD Ryzen 9 3900X 12-Core Processor with 32 GB RAM, on Linux (WSL), with nightly rust. Timings are given as: [lower-bound **best-estimate** upper-bound] | Day | Part 1 | Part 2 | |-----|--------|--------| -| 01 | [101.34 µs **101.95 µs** 102.61 µs] | [105.90 µs **106.40 µs** 106.95 µs] | -| 02 | [2.0990 ms **2.1113 ms** 2.1236 ms] | [2.0954 ms **2.1055 ms** 2.1157 ms] | -| 03 | [38.717 µs **39.002 µs** 39.311 µs] | [175.35 µs **176.59 µs** 177.92 µs] | -| 04 | [147.02 µs **147.75 µs** 148.53 µs] | [1.5579 ms **1.5737 ms** 1.5900 ms] | +| 01 | [79.998 µs **80.349 µs** 80.721 µs] | [76.289 µs **76.616 µs** 76.950 µs] | +| 02 | [2.0386 ms **2.0483 ms** 2.0584 ms] | [2.0823 ms **2.0918 ms** 2.1015 ms] | +| 03 | [45.711 µs **45.937 µs** 46.177 µs] | [267.18 µs **267.95 µs** 268.75 µs] | +| 04 | [143.40 µs **144.00 µs** 144.73 µs] | [1.6165 ms **1.6258 ms** 1.6355 ms] |