Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/ops/lockfile.rs

@weihanglo weihanglo Aug 3, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks. We actually had a similar PR (#17294) recently and got closed because it was a full bot automation not addressing reviewers' question correctly.

This seems to be a fairly pure refactor. Is there any reason it is still behind draft?

View changes since the review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am also interested in how you fount this, if you don't mind sharing.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops, sorry, took it out of draft!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tend to use Ultra mode to do exploration of projects and find interesting optimization opportunities, then will go deep on a few of them (try out a prototype, do some benchmarking, etc.). In this case I actually asked it to find opportunities "similar in spirit" to xmakro's Clippy optimizations which I found neat. It's a very different project though with very different bottlenecks so most of the surfaced findings were not that similar in spirit. I'm happy to share the full output if you want to see it (though it is of course LLM-generated).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That sounds like a fun exploration!

We have a Performance label tracking those. One of the most possible area to improve is asyncifying Cargo. Cargo has its bespoke concurrency control before async/await. For example, dependency source update and manifest parsing are still serial. In #t-cargo > Parallelizing parts of cargo @Kobzol did an experiment on that but not yet ready.

Anyway, if you have found something interesting, feel free to open issues!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rust project may have an LLM policy soonish I guess, thoughif people bring a tidy-up doc and discuss with me as a human, personally I don't mind it is LLM-assisted or not.

Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ fn serialize_resolve(resolve: &Resolve, orig: Option<&str>) -> String {

#[tracing::instrument(skip_all)]
fn are_equal_lockfiles(orig: &str, current: &str, ws: &Workspace<'_>) -> bool {
// Avoid deserializing lockfiles when their contents already match.
if orig.lines().eq(current.lines()) {
return true;
}

// If we want to try and avoid updating the lock file, parse both and
// compare them; since this is somewhat expensive, don't do it in the
// common case where we can update lock files.
Expand All @@ -222,7 +227,7 @@ fn are_equal_lockfiles(orig: &str, current: &str, ws: &Workspace<'_>) -> bool {
}
}

orig.lines().eq(current.lines())
false
}

fn emit_package(dep: &toml::Table, out: &mut String) {
Expand Down