Skip to content
Merged
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
9 changes: 2 additions & 7 deletions crates/napi/src/next_api/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use turbo_rcstr::RcStr;
use turbo_tasks::{
Completion, Effects, FxIndexSet, OperationVc, ReadRef, ResolvedVc, TransientInstance,
TryJoinIterExt, UpdateInfo, Vc, get_effects,
message_queue::{CompilationEvent, DiagnosticEvent, Severity, TimingEvent},
message_queue::{CompilationEvent, Severity, TimingEvent},
};
use turbo_tasks_fs::{
DiskFileSystem, FileContent, FileSystem, FileSystemPath, get_relative_path_to,
Expand Down Expand Up @@ -405,11 +405,6 @@ pub async fn project_new(
is_ci,
)?;

turbo_tasks.send_compilation_event(Arc::new(DiagnosticEvent::new(
Severity::Info,
"Starting the compilation events server ...".to_owned(),
)));

let stats_path = std::env::var_os("NEXT_TURBOPACK_TASK_STATISTICS");
if let Some(stats_path) = stats_path {
let task_stats = turbo_tasks.task_statistics().enable().clone();
Expand Down Expand Up @@ -869,7 +864,7 @@ pub async fn project_write_all_entrypoints_to_disk(

// Send a compilation event to indicate that the files have been written to disk
compilation_event_sender.send_compilation_event(Arc::new(TimingEvent::new(
"Finished writing all entrypoints to disk".to_owned(),
"Finished writing to disk".to_owned(),
now.elapsed(),
)));

Expand Down
9 changes: 8 additions & 1 deletion packages/font/src/google/font-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -6043,7 +6043,14 @@
"defaultValue": 0
}
],
"subsets": ["cyrillic", "cyrillic-ext", "latin", "latin-ext", "vietnamese"]
"subsets": [
"cyrillic",
"cyrillic-ext",
"emoji",
"latin",
"latin-ext",
"vietnamese"
]
},
"Kadwa": {
"weights": ["400", "700"],
Expand Down
2 changes: 1 addition & 1 deletion packages/font/src/google/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10540,7 +10540,7 @@ export declare function Kablammo<
fallback?: string[]
adjustFontFallback?: boolean
subsets?: Array<
'cyrillic' | 'cyrillic-ext' | 'latin' | 'latin-ext' | 'vietnamese'
'cyrillic' | 'cyrillic-ext' | 'emoji' | 'latin' | 'latin-ext' | 'vietnamese'
>
axes?: 'MORF'[]
}): T extends undefined ? NextFont : NextFontWithVariable
Expand Down
1 change: 1 addition & 0 deletions turbopack/crates/turbo-tasks-backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ workspace = true

[features]
default = []
print_cache_item_size = []
verify_serialization = []
verify_aggregation_graph = []
trace_aggregation_update = []
Expand Down
74 changes: 72 additions & 2 deletions turbopack/crates/turbo-tasks-backend/src/backend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,30 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
.take_snapshot(&preprocess, &process, &process_snapshot)
};

#[cfg(feature = "print_cache_item_size")]
#[derive(Default)]
struct TaskCacheStats {
data: usize,
data_count: usize,
meta: usize,
meta_count: usize,
}
#[cfg(feature = "print_cache_item_size")]
impl TaskCacheStats {
fn add_data(&mut self, len: usize) {
self.data += len;
self.data_count += 1;
}

fn add_meta(&mut self, len: usize) {
self.meta += len;
self.meta_count += 1;
}
}
#[cfg(feature = "print_cache_item_size")]
let task_cache_stats: Mutex<FxHashMap<_, TaskCacheStats>> =
Mutex::new(FxHashMap::default());

let task_snapshots = snapshot
.into_iter()
.filter_map(|iter| {
Expand All @@ -924,7 +948,15 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
Option<Result<SmallVec<_>>>,
)| {
let meta = match meta {
Some(Ok(meta)) => Some(meta),
Some(Ok(meta)) => {
#[cfg(feature = "print_cache_item_size")]
task_cache_stats
.lock()
.entry(self.get_task_description(task_id))
.or_default()
.add_meta(meta.len());
Some(meta)
}
None => None,
Some(Err(err)) => {
println!(
Expand All @@ -936,7 +968,15 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
}
};
let data = match data {
Some(Ok(data)) => Some(data),
Some(Ok(data)) => {
#[cfg(feature = "print_cache_item_size")]
task_cache_stats
.lock()
.entry(self.get_task_description(task_id))
.or_default()
.add_data(data.len());
Some(data)
}
None => None,
Some(Err(err)) => {
println!(
Expand Down Expand Up @@ -970,6 +1010,36 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
println!("Persisting failed: {err:?}");
return None;
}
#[cfg(feature = "print_cache_item_size")]
{
let mut task_cache_stats = task_cache_stats
.into_inner()
.into_iter()
.collect::<Vec<_>>();
if !task_cache_stats.is_empty() {
task_cache_stats.sort_unstable_by(|(key_a, stats_a), (key_b, stats_b)| {
(stats_b.data + stats_b.meta, key_b)
.cmp(&(stats_a.data + stats_a.meta, key_a))
});
println!("Task cache stats:");
for (task_desc, stats) in task_cache_stats {
use std::ops::Div;

use turbo_tasks::util::FormatBytes;

println!(
" {} {task_desc} = {} meta ({} x {}), {} data ({} x {})",
FormatBytes(stats.data + stats.meta),
FormatBytes(stats.meta),
stats.meta_count,
FormatBytes(stats.meta.checked_div(stats.meta_count).unwrap_or(0)),
FormatBytes(stats.data),
stats.data_count,
FormatBytes(stats.data.checked_div(stats.data_count).unwrap_or(0)),
);
}
}
}
}

Some((snapshot_time, new_items))
Expand Down
Loading