Skip to content

docs: clarify local LTO guidance#7400

Open
Xuanwo wants to merge 1 commit into
mainfrom
xuanwo/docs-local-lto-guidance
Open

docs: clarify local LTO guidance#7400
Xuanwo wants to merge 1 commit into
mainfrom
xuanwo/docs-local-lto-guidance

Conversation

@Xuanwo

@Xuanwo Xuanwo commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

This clarifies the repository agent instructions for Rust local workflows.

Local development, debugging, and performance testing should avoid LTO so those workflows do not accidentally pay release-artifact build costs or benchmark a build mode that was not explicitly requested. LTO remains available when release artifact validation explicitly asks for it.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jun 22, 2026
@Xuanwo Xuanwo marked this pull request as ready for review June 22, 2026 17:59

@wjones127 wjones127 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree local development and testing don't need LTO. But I'm skeptical that turning it off for profiling in general is a good idea; it makes a meaningful difference in performance, which is the exact thing we are trying to measure in those builds. It would be like turning off SIMD during benchmarking—we'd be measuring the wrong thing.

Now, there are likely some benchmarks that aren't sensitive to LTO: if you are benchmarking IO-bound code, it's probably not necessary. But if you are doing CPU-bound benchmarks, such as distance function work, I would say keep the LTO on. Perhaps we can provide a guideline like that in the AGENTS.md?

Comment thread AGENTS.md
* Coverage: `cargo +nightly llvm-cov -q -p <crate> --branch`
* Coverage HTML: `cargo +nightly llvm-cov -q -p <crate> --branch --html`
* Coverage for file: `python ci/coverage.py -p <crate> -f <file_path>`
* Do not enable LTO for local development, debugging, or performance testing. Keep LTO reserved for explicitly requested release artifact validation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: why provide this guidance, instead of baking in profiles that specify LTO, and telling the agent to use those profiles? As-is, the agent has to figure out what profiles there are and modify them in order to comply with this guidance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants