Skip to content

Commit f3df104

Browse files
committed
WIP: Turbopack: Use bincode to store the contents of value cells
1 parent 0e45230 commit f3df104

28 files changed

+598
-621
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: 3 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 }
@@ -374,6 +373,7 @@ allsorts = { version = "0.14.0", default-features = false, features = [
374373
] }
375374
anyhow = "1.0.100"
376375
async-trait = "0.1.64"
376+
bincode = { version = "2.0.1", features = ["serde"] }
377377
bitfield = "0.18.0"
378378
byteorder = "1.5.0"
379379
bytes = "1.1.0"
@@ -393,12 +393,13 @@ either = "1.9.0"
393393
erased-serde = "0.4.5"
394394
flate2 = "1.0.28"
395395
futures = "0.3.31"
396-
futures-util = "0.3.31"
397396
futures-retry = "0.6.0"
397+
futures-util = "0.3.31"
398398
hashbrown = "0.14.5"
399399
image = { version = "0.25.8", default-features = false }
400400
indexmap = "2.7.1"
401401
indoc = "2.0.0"
402+
inventory = "0.3.21"
402403
itertools = "0.10.5"
403404
lightningcss = { version = "1.0.0-alpha.68", features = [
404405
"serde",
@@ -443,11 +444,10 @@ ringmap = "0.1.3"
443444
roaring = "0.10.10"
444445
rstest = "0.16.0"
445446
rustc-hash = "2.1.1"
446-
twox-hash = { version = "2.1.0", features = ["xxhash64", "xxhash3_128"] }
447447
semver = "1.0.16"
448448
serde = { version = "1.0.217", features = ["derive"] }
449-
serde_json = "1.0.138"
450449
serde_bytes = "0.11.15"
450+
serde_json = "1.0.138"
451451
serde_path_to_error = "0.1.16"
452452
serde_qs = "0.13.0"
453453
serde_with = "3.12.0"
@@ -458,18 +458,19 @@ smallvec = { version = "1.15.1", features = [
458458
"const_new",
459459
"impl_bincode",
460460
] }
461-
swc_sourcemap = "9.3.4"
462-
strsim = "0.11.1"
463461
shrink-to-fit = "0.2.10"
462+
strsim = "0.11.1"
463+
swc_sourcemap = "9.3.4"
464464
syn = "2.0.100"
465465
tempfile = "3.20.0"
466-
thread_local = "1.1.8"
467466
thiserror = "1.0.48"
467+
thread_local = "1.1.8"
468468
tokio = "1.43.0"
469469
tokio-util = { version = "0.7.13", features = ["io", "rt"] }
470470
tracing = "0.1.37"
471471
tracing-subscriber = "0.3.16"
472472
triomphe = { git = "https://github.com/sokra/triomphe", branch = "sokra/unstable" }
473+
twox-hash = { version = "2.1.0", features = ["xxhash64", "xxhash3_128"] }
473474
unsize = "1.1.0"
474475
unty = "0.0.4"
475476
url = "2.2.2"
@@ -478,7 +479,6 @@ uuid = "1.18.1"
478479
vergen = { version = "9.0.6", features = ["cargo"] }
479480
vergen-gitcl = { version = "1.0.8", features = ["cargo"] }
480481
webbrowser = "1.0.6"
481-
inventory = "0.3.21"
482482

483483
[patch.crates-io]
484484
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
@@ -2204,9 +2204,10 @@ impl NextConfig {
22042204
/// A subset of ts/jsconfig that next.js implicitly
22052205
/// interops with.
22062206
#[turbo_tasks::value(serialization = "custom", eq = "manual")]
2207-
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
2207+
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize, Encode, Decode)]
22082208
#[serde(rename_all = "camelCase")]
22092209
pub struct JsConfig {
2210+
#[bincode(with = "turbo_bincode::serde_json")]
22102211
compiler_options: Option<serde_json::Value>,
22112212
}
22122213

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
@@ -1057,6 +1057,9 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
10571057
(meta, data)
10581058
};
10591059
let process = |task_id: TaskId, (meta, data): (Option<Vec<_>>, Option<Vec<_>>)| {
1060+
// TODO: perf: Instead of returning a `Vec` of individually allocated `SmallVec`s, it'd
1061+
// be better to append everything to a flat per-task or per-shard `Vec<u8>`, and have
1062+
// each `serialize` call return `(start_idx, end_idx)`.
10601063
(
10611064
task_id,
10621065
meta.map(|d| self.backing_storage.serialize(task_id, &d)),

0 commit comments

Comments
 (0)