From 3d2698e42b763a8b291c546360efcf2512995fa2 Mon Sep 17 00:00:00 2001 From: clover caruso Date: Mon, 19 Oct 2026 11:26:41 -0700 Subject: [PATCH] fix(notebook): keep the notebook listing in one write The listing kept after each refresh was serialized straight into its file, one write per token. Deleting the Empty section of the corpus notebook m6/native-features-01 on the iPad simulator (debug build) held the notebook for about 14.5 s, sampled inside keep_listing's serde writes; written whole, the same step took under 1.5 s, the scripted run's next step landing on time. - Deleting, moving and restoring sections no longer pause for seconds. Assisted-by: claude-opus-5.5 --- crates/notebook/src/session.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/notebook/src/session.rs b/crates/notebook/src/session.rs index 9eb8486b069068cf5d3b9eb6865b3a29d0a2fc0b..65a5c10d23de3a47552eac0977b91d6c4ca39149 100644 --- a/crates/notebook/src/session.rs +++ b/crates/notebook/src/session.rs @@ -627,7 +627,8 @@ impl Notebook { let _ = (|| -> Result<()> { let folder = self.listing.parent().unwrap_or(Path::new(".")); let mut file = tempfile::NamedTempFile::new_in(folder)?; - serde_json::to_writer(&mut file, &self.read).map_err(io::Error::from)?; + // Whole, as a write per token takes seconds. + file.write_all(&serde_json::to_vec(&self.read).map_err(io::Error::from)?)?; file.persist(&self.listing).map_err(|error| error.error)?; Ok(()) })(); -- 2.54.1