mirror of
https://github.com/storytold/figcraft.git
synced 2026-11-29 17:55:59 +01:00
Replica::from_snapshot borrowed the changes and cloned the whole Vec<Change> before applying it, because the review-settings clamp rewrites some of them in place. Every caller already owns the snapshot (Client::join, the rejoin path, Server::restore), so it now takes the Vec by value: a large file's snapshot is no longer copied and then dropped twice on the way in. The server's publish path still borrows and copies explicitly. In a wasm32 build joining a 120k-layer file through the full-snapshot catch-up (what an older server sends), this cut peak memory from 722 MiB to 455 MiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>