78 points by rust_enthusiast 6 months ago flag hide 23 comments
johncage 6 months ago next
I've been wondering if Rust is suitable for building a real-time collaborative text editor. This post has piqued my interest!
ihnm 6 months ago next
Rust's low-level capabilities certainly make it a good choice. I'm excited to see the end result.
johncage 6 months ago prev next
That's a great question, @lispmachine! Yes, I'm looking into using CRDTs as it'll allow me to avoid holding onto state information.
rosettacode 6 months ago prev next
A real-time collaborative text editor in Rust using CRDTs sounds exciting; good luck along the way!
jkumin 6 months ago next
How have you been handling performance testing so far? Did you experience any challenges implementing a performant CRDT?
johncage 6 months ago next
Performance testing has been a bit of a struggle with CRDTs, but I'm using a few open-source tools which help.
jkumin 6 months ago next
What tools are you using? I might need them in my current project.
johncage 6 months ago next
I'm making use of 'criterion.rs' for micro-benchmarks and 'insta.rs' for testing my more complex CRDT-related functionalities.
lispmachine 6 months ago prev next
I'm curious how you plan on implementing real-time collaboration? Are you going to look into CRDTs?
gemini 6 months ago next
Awesome! I've always wanted to experiment with CRDTs, this might be the perfect opportunity to learn more.
aaronsplace 6 months ago prev next
Just wondering whether using WASM and Rust would be a viable alternative to WebSockets on the browser side.
apollonius 6 months ago next
It could be a possibility, but WebSockets are an established protocol and easier to deal with.
mathemagician 6 months ago prev next
WASM might indeed create an interesting stack between Rust and modern web frameworks. Looking forward to learning more!
stagleap 6 months ago prev next
How are you managing state synchronization and complexity?
johncage 6 months ago next
State synchronization is straightforward using CRDTs since I don't have to store or worry about state on the server.
erisian 6 months ago prev next
What about eventual consistency between connected clients? Do they run independently or do you enforce a master-slave arrangement?
johncage 6 months ago next
After recent readings on the topic, I decided to favor a peer-to-peer arrangement and let each client make individual decisions.
somename 6 months ago prev next
Interesting. I would have thought that policing communication in a master-slave fashion would ensure better ordering.
johncage 6 months ago next
From my understanding, CRDTs compose themselves well enough to avoid the necessity of extra policing measures.
zuigang 6 months ago prev next
@johncage Do you apply a particular CRDT strategy? G-counter, LWW-register, Map-reduce or another type?
johncage 6 months ago next
I'm using a combination of G-counter and RGA-tree for my real-time collaborative text editor, as text edits can be thought of as add-wins operations.
absalom 6 months ago next
So if I understand correctly, you're using a G-counter to handle core ordering and an RGA-tree for managing hierarchical structure?
johncage 6 months ago next
You got it! Also, if anybody's interested, there's a fair amount I've learned throughout this journey, some of which I've published on my blog: <https://my-rust-blog.com>