Repository navigation
Replies: 2 comments 2 replies
|
@ciksters thank you for this report, the measurements made it easy to find. It is a bug, and you looked in the right place: the time went into packing, not into writing. A design around an imported assembly holds hundreds of small files in its package, a mesh and an exact body for every part of the board. layerling compresses small files on the page itself, only the large ones go to a worker, and every autosave compressed all of them again in one go, although only the project file had changed. That is your single long task before each write. Since 1.168.0 a file that has not changed is compressed once and then put into the package as it is, and what does have to be compressed is done in short slices, so the editor gets its turn in between. In my test design (400 imported parts, a 42 MB package) the editor was held for 3 to 4 seconds per save before and for less than a tenth of a second after. That covers your suggestions 2 and 3 in effect. I would rather not add a manual save mode: a switch that turns saving off is the kind of thing that loses work sooner or later, and with this fix it should not be needed any more. I could not test with your own design, so I would be glad to hear whether it is smooth for you now. If it still freezes, please send a bug report from the editor (the "Bug report" link, it packs everything into a ZIP you can attach here), that would help me a lot to reproduce it with your file. If layerling is useful to you, a small donation helps me keep working on it. Thank you! |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi, and thanks for layerling! It sits right where I need it between Tinkercad and Fusion. Reeeealy grat thing!
The problem
I build enclosures around imported STEP models, for example a Raspberry Pi board. In those designs the editor freezes for several seconds after almost every change: move a part, change a size, group. With constant changes it feels as if the app "thinks" after every step.
The history limit ("Saved history") is already at its minimum, so this is not about a long undo history.
Measurements
Setup:
brave://gpu).lylpackage is about 18.4 MBHow I measured:
PerformanceObserverforlongtaskentries;IDBObjectStore.prototype.put, recording when the project package is written, its size and the transaction commit time;requestIdleCallback, to find the start of each save;projectShapesput)The 4.3–4.6 s block is always a single long task inside the save. It sits between the idle callback that starts the save and the IndexedDB
put. The write is cheap, so the time goes into packing:exportLylProject, which serializes the states and zips them with fflate on the main thread. That matches the comment ininputPause.tsthat saving a dense design takes the main thread for a second or more. Here it is over four seconds, about every 15–20 s of active work.waitForInputPausehelps while I am actively dragging. But every pause of 0.9 s, or at most 6 s of work, starts a save, and the next click then waits for it.The other ~28 s of blocking was regular editing work (geometry and booleans), which I would expect with a model like this.
My temporary workaround: a local build with manual save
For now I run a local build (
next build/next start) with a small patch. It is a few lines in two files and needs no format changes:app/page.tsx,saveProjectShapesWhenIdle: when manual mode is on, a save request does not pack. It waits until the user asks for a save, and then superseded revisions are skipped as before. A save happens on:openDashboard);visibilitychange/pagehide), which already saves immediately today.beforeunloadprompt appears while changes are unsaved.LayerlingEditor.tsx: in manual mode Ctrl+S triggers this browser save instead of the.lylfile export.localStorage["layerling.manualSave"] = "0"restores the normal autosave.With this the editor stays responsive. The only freeze is the ~4 s at Ctrl+S, when I choose it. The trade-off is clear: if the browser crashes, changes since the last Ctrl+S are lost. That is why it should be optional.
Suggestions
Any of these would solve it for me. I list them in order of how much they would change:
.lyloff the main thread, in a Web Worker, like the geometry worker from layerling no longer freezes with large meshes #800. The editor would then stay usable while a save runs.I can send the design itself through "Bug report" in the editor footer if you'd like to reproduce it. I'm also happy to share the patch, or to run more measurements on a build with extra timing (for example how much time goes to JSON vs. hashing vs. zipping), if that helps.
All reactions