From e3dfce8cf4d42a8aa6a47f7ca984f2dacfb75a0c Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 2 Aug 2026 19:11:37 -0400 Subject: [PATCH] Avoid parsing unchanged lockfiles --- src/ops/lockfile.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ops/lockfile.rs b/src/ops/lockfile.rs index 439dd8fd7d9..6a27714d086 100644 --- a/src/ops/lockfile.rs +++ b/src/ops/lockfile.rs @@ -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. @@ -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) {