Skip to content

Commit 5fd1a80

Browse files
committed
WIP: Turbopack: Use bincode to store the contents of value cells
1 parent a2afb2d commit 5fd1a80

File tree

30 files changed

+712
-628
lines changed

30 files changed

+712
-628
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@ rustflags = [
7373
linker = "arm-linux-gnueabihf-gcc"
7474

7575
[target.wasm32-unknown-unknown]
76-
rustflags = ["-Zshare-generics=y", "--cfg", 'getrandom_backend="wasm_js"']
76+
rustflags = ["-Zshare-generics=y", "--cfg", 'getrandom_backend="wasm_js"']

Cargo.lock

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ preset_env_base = "6.0.0"
360360

361361

362362
# General Deps
363-
bincode = { version = "2.0.1", features = ["serde"] }
364363
chromiumoxide = { version = "0.5.4", features = [
365364
"tokio-runtime",
366365
], default-features = false }
@@ -378,6 +377,7 @@ async-compression = { version = "0.3.13", default-features = false, features = [
378377
"tokio",
379378
] }
380379
async-trait = "0.1.64"
380+
bincode = { version = "2.0.1", features = ["serde"] }
381381
bitfield = "0.18.0"
382382
byteorder = "1.5.0"
383383
bytes = "1.1.0"
@@ -397,12 +397,13 @@ either = "1.9.0"
397397
erased-serde = "0.4.5"
398398
flate2 = "1.0.28"
399399
futures = "0.3.31"
400-
futures-util = "0.3.31"
401400
futures-retry = "0.6.0"
401+
futures-util = "0.3.31"
402402
hashbrown = "0.14.5"
403403
image = { version = "0.25.8", default-features = false }
404404
indexmap = "2.7.1"
405405
indoc = "2.0.0"
406+
inventory = "0.3.21"
406407
itertools = "0.10.5"
407408
lightningcss = { version = "1.0.0-alpha.68", features = [
408409
"serde",
@@ -447,11 +448,10 @@ ringmap = "0.1.3"
447448
roaring = "0.10.10"
448449
rstest = "0.16.0"
449450
rustc-hash = "2.1.1"
450-
twox-hash = { version = "2.1.0", features = ["xxhash64", "xxhash3_128"] }
451451
semver = "1.0.16"
452452
serde = { version = "1.0.217", features = ["derive"] }
453-
serde_json = "1.0.138"
454453
serde_bytes = "0.11.15"
454+
serde_json = "1.0.138"
455455
serde_path_to_error = "0.1.16"
456456
serde_qs = "0.13.0"
457457
serde_with = "3.12.0"
@@ -462,18 +462,19 @@ smallvec = { version = "1.15.1", features = [
462462
"const_new",
463463
"impl_bincode",
464464
] }
465-
swc_sourcemap = "9.3.4"
466-
strsim = "0.11.1"
467465
shrink-to-fit = "0.2.10"
466+
strsim = "0.11.1"
467+
swc_sourcemap = "9.3.4"
468468
syn = "2.0.100"
469469
tempfile = "3.20.0"
470-
thread_local = "1.1.8"
471470
thiserror = "1.0.48"
471+
thread_local = "1.1.8"
472472
tokio = "1.43.0"
473473
tokio-util = { version = "0.7.13", features = ["io", "rt"] }
474474
tracing = "0.1.37"
475475
tracing-subscriber = "0.3.16"
476476
triomphe = { git = "https://github.com/sokra/triomphe", branch = "sokra/unstable" }
477+
twox-hash = { version = "2.1.0", features = ["xxhash64", "xxhash3_128"] }
477478
unsize = "1.1.0"
478479
unty = "0.0.4"
479480
url = "2.2.2"
@@ -482,7 +483,6 @@ uuid = "1.18.1"
482483
vergen = { version = "9.0.6", features = ["cargo"] }
483484
vergen-gitcl = { version = "1.0.8", features = ["cargo"] }
484485
webbrowser = "1.0.6"
485-
inventory = "0.3.21"
486486

487487
[patch.crates-io]
488488
bincode = { git = "https://github.com/bgw/bincode.git", branch = "bgw/patches" }

crates/next-core/src/next_config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,9 +2207,10 @@ impl NextConfig {
22072207
/// A subset of ts/jsconfig that next.js implicitly
22082208
/// interops with.
22092209
#[turbo_tasks::value(serialization = "custom", eq = "manual")]
2210-
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2210+
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Encode, Decode)]
22112211
#[serde(rename_all = "camelCase")]
22122212
pub struct JsConfig {
2213+
#[bincode(with = "turbo_bincode::serde_json")]
22132214
compiler_options: Option<serde_json::Value>,
22142215
}
22152216

turbopack/crates/turbo-tasks-backend/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ indexmap = { workspace = true }
4242
lmdb-rkv = { version = "0.14.0", optional = true }
4343
once_cell = { workspace = true }
4444
parking_lot = { workspace = true }
45-
pot = "3.0.0"
4645
rand = { workspace = true }
4746
ringmap = { workspace = true, features = ["serde"] }
4847
rustc-hash = { workspace = true }
@@ -53,6 +52,7 @@ smallvec = { workspace = true }
5352
tokio = { workspace = true }
5453
tracing = { workspace = true }
5554
thread_local = { workspace = true }
55+
turbo-bincode = { workspace = true }
5656
turbo-persistence = { workspace = true }
5757
turbo-rcstr = { workspace = true }
5858
turbo-tasks = { workspace = true }

turbopack/crates/turbo-tasks-backend/src/backend/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,6 +1068,9 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
10681068
(meta, data)
10691069
};
10701070
let process = |task_id: TaskId, (meta, data): (Option<Vec<_>>, Option<Vec<_>>)| {
1071+
// TODO: perf: Instead of returning a `Vec` of individually allocated `SmallVec`s, it'd
1072+
// be better to append everything to a flat per-task or per-shard `Vec<u8>`, and have
1073+
// each `serialize` call return `(start_idx, end_idx)`.
10711074
(
10721075
task_id,
10731076
meta.map(|d| self.backing_storage.serialize(task_id, &d)),

0 commit comments

Comments
 (0)