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
21 changes: 13 additions & 8 deletions turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -852,26 +852,31 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
return (None, None);
}
let len = inner.len();
let mut meta = Vec::with_capacity(len);
let mut data = Vec::with_capacity(len);

let meta_restored = inner.state().meta_restored();
let data_restored = inner.state().data_restored();

let mut meta = meta_restored.then(|| Vec::with_capacity(len));
let mut data = data_restored.then(|| Vec::with_capacity(len));
for (key, value) in inner.iter_all() {
if key.is_persistent() && value.is_persistent() {
match key.category() {
TaskDataCategory::Meta => {
meta.push(CachedDataItem::from_key_and_value_ref(key, value))
if let Some(meta) = &mut meta {
meta.push(CachedDataItem::from_key_and_value_ref(key, value))
}
}
TaskDataCategory::Data => {
data.push(CachedDataItem::from_key_and_value_ref(key, value))
if let Some(data) = &mut data {
data.push(CachedDataItem::from_key_and_value_ref(key, value))
}
}
_ => {}
}
}
}
Comment on lines 861 to 877

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 don't deeply understand this code, but should this whole loop be skipped if both meta and data were restored?


(
inner.state().meta_restored().then_some(meta),
inner.state().data_restored().then_some(data),
)
(meta, data)
};
let process = |task_id: TaskId, (meta, data): (Option<Vec<_>>, Option<Vec<_>>)| {
(
Expand Down