Repository navigation
perf(cad): download only the parts that changed after a cad sync - #213
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
# Conflicts: # apps/server/src/cad/panelHttp.test.ts # apps/server/src/cad/panelHttp.ts # apps/web/src/cad/CadAssetDelivery.test.ts # apps/web/src/cad/CadAssetDelivery.ts
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every new snapshot downloaded the whole model again, even when nothing or one part had changed. On the same machine that costs little. Over a tailnet it repeats the slowest part of loading after every Sync. The browser cache was keyed by snapshot, so a re-export with identical geometry and an edit to one part both re-sent everything.
The browser now keeps decoded assets in IndexedDB by content hash (
CadAssetCache), so any snapshot, chat, or server with the same geometry reuses them. On load, assets the cache holds are read and verified locally. The client then names the missing ones as a hex bitmap over the manifest's distinct assets,assets=<hex>, ontransfer-indexand on every range. The server checks the selection against the scene's own manifest and prepares a transfer of only those assets; the artifact store already keys transfers by their asset list. When nothing is cached, the request is unchanged, so the full shared transfer is still used.Results
apps/server/scripts/cad-remote-load-e2e.ts(from #212) on a 76-part, 22 MB STEP motor. The remote page is plain http at the LAN address, capped at 40 Mbit/s, and stays open while the model syncs. Geometry bytes on the wire:In the one-part case, the page requested
transfer-index?assets=…and one range for that single asset. On the smalldm1fixture, an edit that changed 3 of 7 assets transferred 18 KB instead of 36 KB.A reload served from the asset cache took 0.83 s against 0.60 s on main, in one run each. Cached GLBs are hashed on read, and a plain-http page has no Web Crypto, so it hashes in JS.
The first load on a new device is unchanged by this PR.
Proof
Stacked on #212.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.