Are CRDTs suitable for shared editing?
In xi, there are two issues. One is the cost of the CRDT representation, the other is whether it accurately represents what you&#x27;re trying to do. Classical implementations of CRDT use a heavyweight node per character in the text, each with its own unique and permanent id. In my research in xi, it became clear to me that more compressed representations are possible, and the xi CRDT is one such: it is an &quot;op&quot; object per edit, but the string itself is just a string.<p>Lately there has been other work pursuing those compressed representations: Chronofold, I think Martin Kleppmann&#x27;s automerge has some memory-efficiency work, and there are others.<p>But at least in the context of xi, this is not where things went wrong. As I&#x27;ve written about (and the author was kind enough to link), it&#x27;s because CRDT merges aren&#x27;t a good fit for the problems a code editor is trying to solve, particularly when the &quot;collaborators&quot; are automated processes such as language servers.<p>In human collaborative editing, it&#x27;s important to preserve text that&#x27;s being entered, even in the face of conflict. But when a peer is an automated service, it&#x27;s much better to drop the edit on the floor and recompute. I&#x27;m simplifying here, as it depends on the service - some are history-insensitive, some are sensitive to a small window of history (in the case of automatically inserting indentation, etc), and (speculative) other services may be sensitive to more history.<p>In addition, the CRDT constrains the data model considerably. In other words, it&#x27;s unfortunately <i>not</i> a clean abstraction where you can easily add higher level layers on top of the CRDT, but you always have to design those with the CRDT in mind (ie, everything still has to be a monotonic semi-lattice).<p>So, as with everything else, it&#x27;s a tradeoff, and it&#x27;s a question of weighing the pros and cons. I&#x27;m glad to see work being done to improve CRDT, but even with a very efficient representation and solid algorithms, the problems with CRDT would be enough for me not to use them in a code editor.