diff --git a/turbopack/crates/turbo-persistence/src/collector.rs b/turbopack/crates/turbo-persistence/src/collector.rs index 86ac0daab07a2..9a979775c025f 100644 --- a/turbopack/crates/turbo-persistence/src/collector.rs +++ b/turbopack/crates/turbo-persistence/src/collector.rs @@ -93,7 +93,7 @@ impl Collector { /// Sorts the entries and returns them along with the total key and value sizes. This doesn't /// clear the entries. pub fn sorted(&mut self) -> (&[CollectorEntry], usize, usize) { - self.entries.sort_by(|a, b| a.key.cmp(&b.key)); + self.entries.sort_unstable_by(|a, b| a.key.cmp(&b.key)); (&self.entries, self.total_key_size, self.total_value_size) } diff --git a/turbopack/crates/turbo-persistence/src/write_batch.rs b/turbopack/crates/turbo-persistence/src/write_batch.rs index bf4692097f65f..7039280570889 100644 --- a/turbopack/crates/turbo-persistence/src/write_batch.rs +++ b/turbopack/crates/turbo-persistence/src/write_batch.rs @@ -291,7 +291,7 @@ impl WriteBatch { shared_error.into_inner()?; let seq = self.current_sequence_number.load(Ordering::SeqCst); - new_sst_files.sort_by_key(|(seq, _)| *seq); + new_sst_files.sort_unstable_by_key(|(seq, _)| *seq); Ok(FinishResult { sequence_number: seq, new_sst_files,