Skip to content

Reland "Turbopack: avoid using rayon in favor of tokio tasks" #82661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: canary
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions turbopack/crates/turbo-persistence-tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::path::PathBuf;

use anyhow::{Context, Result, bail};
use turbo_persistence::{MetaFileEntryInfo, TurboPersistence};
use turbo_persistence::{MetaFileEntryInfo, SerialScheduler, TurboPersistence};

fn main() -> Result<()> {
// Get CLI argument
Expand All @@ -16,7 +16,7 @@ fn main() -> Result<()> {
bail!("The provided path does not exist: {}", path.display());
}

let db = TurboPersistence::open_read_only(path)?;
let db: TurboPersistence<SerialScheduler> = TurboPersistence::open_read_only(path)?;
let meta_info = db
.meta_info()
.context("Failed to retrieve meta information")?;
Expand Down
2 changes: 1 addition & 1 deletion turbopack/crates/turbo-persistence/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ memmap2 = "0.9.5"
parking_lot = { workspace = true }
qfilter = { version = "0.2.4", features = ["serde"] }
quick_cache = { workspace = true }
rayon = { workspace = true }
rustc-hash = { workspace = true }
smallvec = { workspace = true }
thread_local = { workspace = true }
Expand All @@ -32,6 +31,7 @@ zstd = { version = "0.13.2", features = ["zdict_builder"] }

[dev-dependencies]
rand = { workspace = true, features = ["small_rng"] }
rayon = { workspace = true }
tempfile = { workspace = true }

[lints]
Expand Down
9 changes: 9 additions & 0 deletions turbopack/crates/turbo-persistence/src/collector.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::mem::take;

use crate::{
ValueBuffer,
collector_entry::{CollectorEntry, CollectorEntryValue, EntryKey},
Expand Down Expand Up @@ -111,4 +113,11 @@ impl<K: StoreKey, const SIZE_SHIFT: usize> Collector<K, SIZE_SHIFT> {
self.total_value_size = 0;
self.entries.drain(..)
}

/// Clears the collector and drops the capacity
pub fn drop_contents(&mut self) {
drop(take(&mut self.entries));
self.total_key_size = 0;
self.total_value_size = 0;
}
}
Loading
Loading