Skip to content

Commit 04ff7d1

Browse files
committed
doc update
1 parent f0ee6b2 commit 04ff7d1

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Sources/CRDT/Documentation.docc/UsingCRDTs.md

+14-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ The choice of type impacts how much memory is required as additional tracking in
3232
In ``ORSet``, ``ORMap``, and ``List`` the combination of the both the size of the `ActorID` and the size of the Lamport timestamp are used to track the history of each element.
3333
The causal tree implementation of ``List`` includes an additional metadata to track the parent id within the causal tree.
3434

35-
3635
### Memory Overhead
3736

3837
The memory overhead is minimal for the simplest CRDTs: ``GCounter``, ``PNCounter``, and ``GSet``.
@@ -42,6 +41,20 @@ The memory needed to track the history when you can add, remove, and update unor
4241
The most memory is required to track history when you can add, remove, and maintain an ordered set of values.
4342
The memory needed for `List` grows with the combination of all additions, removals, and edits to the array.
4443

44+
If the size of a list element is fairly small, a CRDT can represent a significant expansion in the total memory needed to represent that list.
45+
This may not be a significant issue, but is definitely worth being aware of.
46+
As an example, the library tests include [a test that shows the expansion of rough memory needed to store a string](https://github.com/heckj/CRDT/blob/f0ee6b25937a8ac1202432eba856d98f76f1cdf6/Tests/CRDTTests/grokTests.swift#L111) as a CRDT list of characters, which you might do to represent a collaboratively edited description.
47+
The ``List`` CRDT type has the most memory overhead, but provides the most functionality in allowing items to be added, removed, updated, and their ordering preserved.
48+
This space of CRDTs also has the most ongoing research and experimentation to optimize it.
49+
50+
Using a single character string as an `ActorID`, the expansion in space is roughly 21 times:
51+
52+
```
53+
causalTree List size: 326
54+
base list size: 15
55+
expansion factor: 21.733333333333334
56+
```
57+
4558
### Seamless Replication Doesn't Imply Correctness
4659

4760
When you start off with CRDT types that are independent, merging them is deterministic, meaning that you will always get the same result, but that result may not be what you perceive as correct.

0 commit comments

Comments
 (0)