From f5a45672beae135de16112d66844ef9c1e5e538d Mon Sep 17 00:00:00 2001 From: Connor Tsui Date: Fri, 7 Aug 2026 02:55:46 +0000 Subject: [PATCH] Build benchmarks with whole-program optimization `profile.bench` used `codegen-units = 16` with no LTO. Under those settings, adding unrelated code to a crate reshuffles which functions share a codegen unit, and cross-unit inlining changes for functions whose source did not change. A benchmark then moves without its code moving, which is indistinguishable from a real regression. The effect is not small. Adding a scalar function framework to `vortex-array` on a separate branch moved several `take_filter_list` and `list_sum` benchmarks by 14-16%, none of which had a source change, while every `take_filter_primitive` benchmark held. `codegen-units = 1` with fat LTO removes the variable. Benchmark builds get slower in exchange. Signed-off-by: Connor Tsui Co-authored-by: Claude --- Cargo.toml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1484b75de11..4516c2e0326 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -409,9 +409,16 @@ debug = "full" inherits = "release" [profile.bench] -codegen-units = 16 +# Benchmarks exist to attribute a change in measurement to a change in code, so they are built +# whole-program. With `codegen-units = 16` and no LTO, adding unrelated code to a crate reshuffles +# which functions share a codegen unit, which changes cross-unit inlining for functions whose +# source did not change. That reports as a regression in code the branch never touched. +# +# `profile.release` deliberately keeps LTO off, because Vortex's performance must not depend on a +# downstream crate enabling it. That argument is about shipped code and does not apply here. +codegen-units = 1 debug = "full" -lto = false +lto = true [profile.samply] inherits = "release"