Movable tree CRDTs and Loro's implementation
21–30 of 32 posts
Re: Movable tree CRDTs and Loro's implementation
#22I wonder if there has been any practical CRDT for data dense applications, such as images (pixels) and 3D models?
https://digest.browsertech.com/archive/browsertech-digest-ho...
Re: Movable tree CRDTs and Loro's implementation
#23I wonder if there has been any practical CRDT for data dense applications, such as images (pixels) and 3D models?
Let's say we're building an image editor like Photoshop. An uncompressed 102 megapixel image with 16-bit color depth per channel (a photo from a Fujifilm GFX100 camera) would be about 610 MB as a TIFF. Representing each pixel of the image as a separate last-write-wins register would impose a high overhead, but such a representation doesn't actually make any sense to preserve a user's intention. The edits the user will perform are things like "increase image contrast by 15%" or "paint spline [(0,0), (1500, 1500)] with brush Q and color #000". If we sync each pixel by lamport timestamp, we could end up with user 1's contrast applying to all pixels except for those painted by user 2, which would give a weird looking image with painted-over pixels looking out of place.
Instead you'd probably want to represent user intention as a list of edit operations, which are much smaller than a whole 102MB pixel grid. A CRDT data structure is one possible technical mechanism perform to synchronize that user intent, but you pick the structure to match the user intent semantics, not to match the concrete data layout of your output.
You may still end up having edit operations that contain massive amounts of data, like "add new layer named `bg` below layer `fg` with pixels `data:(10mb of pixels)` at (1500, 1500)". But the overhead for the synchronization of that kind of edit command is very low, it's size is O(1), not O(pixels in the edit command).
Re: Movable tree CRDTs and Loro's implementation
#24Re: Movable tree CRDTs and Loro's implementation
#25After I finished the project, I kinda knew why Google Drive only allows to display and modify on the same hierarchical level. There are so many constraints that you have to consider when implementing this in a nested view with many nodes.
Re: Movable tree CRDTs and Loro's implementation
#26I wonder if there has been any practical CRDT for data dense applications, such as images (pixels) and 3D models?
Never tried building it, though. And I’m not sure it would actually be practical, but it would at least preserve the full history of the document.
Re: Movable tree CRDTs and Loro's implementation
#27Asking for advice: I do not have a multiplayer app, but I have some large, interconnected, denormalized trees on my frontend as user profiles. Think like a tiled layout, where a user can add/remove/resize tiles, and then add a number of components into each tiled slot, each of those having their own profiles too. Multiple "layouts" can exist with different arrangements of tiles, and theres some other complexity with…
Maintaining the shared state with REST calls that overwrite parts of server state is indeed brittle, and really only suitable for overwriting fields on flat data records. It also requires that you consider server-client state coordination with care at all times, and things can easily get out of sync in non-happy paths.
Like you said, building out a CRDT which specifies how updates are coalesced will significantly reduce cognitive burden.
Re: Movable tree CRDTs and Loro's implementation
#28Wow I have to read this! For a freelance client of mine, I have open sourced React Table Library [0] with the focus on tree operations. They are handling a folder/file tree structure of 100 thousands nodes where it is possible to move folders/files, clone them, lazy load them on a top and nested level, etc. And all of it in the same table structure. After I finished the project, I kinda knew why Google Drive only all…
Re: Movable tree CRDTs and Loro's implementation
#29Earlier quoted context omitted.
If your application makes active use of multiple tabs, it might make sense to use YJS or something, because it's very effective in resolving those types of problems. However, if your profile edits are single-user only, it's probably overkill to introduce a CRDT. At first glance, it seems the two-tabs-open scenario is your highest source of bugs, so what you could do is use a BroadcastChannel to signal update events t…
How is YJS different from introducing CRDT? Doesn't it basically just do that for you anyways? If CRDT is complications and difficult to manage, either YJS resolves that completely, or more likely that complexity will leak out of the abstraction layer no matter what. To me it seems more like that OP should compare and contrast concurrency solutions, one of which is CDRT via YJS or another could be something like conc…
Re: Movable tree CRDTs and Loro's implementation
#30Earlier quoted context omitted.
what rich text are you using?
We built it from scratch, so not based on prosemirror or contenteditable or anything like that (as we needed something which feels as if you're just editing text but also supports outlining features)