Kevin Jahns
Overview, scope, challenges
Modern Collaborative Applications
Desirable Properties:
- Synchronize automatically
- Application is available offline
- Visualization of change history

Tracking changes example:
The Yjs Framework
Yjs for collaborative application state

CRDTs in the real-world
Challenges
- Tracking the editing history incurs overhead
Observation
- While the amount of content that a user can insert is virtually unbounded, the amount of operations a user can call is not.
- I.e. A user typing at 30 characters per second non-stop for 1 year can only produce ~16 millions keystrokes
- We can optimize for user-behavior
The Yjs Algorithm
- Compound representation of insertions
- ..
- ..
Compressing Changes
A
client="Bob"
clock=0
B
client="Bob"
clock=1
C
client="Bob"
clock=2
ABC
client="Bob"
clock=0
The Yjs Algorithm
- Compound representation of insertions
- Simple pruning scheme for untracked deleted content
- ..
Compressing Changes
A
client="Bob"
clock=0
B
client="Bob"
clock=1
C
client="Bob"
clock=2
ABC
client="Bob"
clock=0
len = 3
deleted=true
client="Bob"
clock=0
The Yjs Algorithm
- Compound representation of insertions
- Simple pruning scheme for untracked deleted content
- Binary compression for encoding document updates (variable length encoding, run-length encoding, custom JSON encoder)
Compressing Changes
More details: Kevin's Blog
A
client="Bob"
clock=0
B
client="Bob"
clock=1
C
client="Bob"
clock=2
ABC
client="Bob"
clock=0
len = 3
deleted=true
client="Bob"
clock=0
Benchmarking
[B4] Real-world editing trace
- Research paper (17 pages)
- 182,315 single-character insertion operations
- 77,463 single-character deletion operations
- 259,778 operations totally
Results
Yjs | Automerge | Automerge (performance branch) | delta-crdts | |
---|---|---|---|---|
Time to apply changes | 6 s | 490 s | 750s | 20134 s |
Encoded document | 0.160 MB | 84 MB | 0.296 MB | 7.9 MB |
Memory usage | 3.2MB | 1.1 GB | ~ | 34.4 MB |
Loading to memory | 0.086 s | 38 s | 208 s | 52 s |

Benchmarking
[B4x100] Real-world editing trace
- Apply the [B4] 100 times.
- 25,977,800 operations totally
- 10 million characters in the final document
- For comparison: The novel "Game of Thrones: A song of Ice and Fire" only contains 1.6 million characters
Results
Yjs | |
---|---|
Time to apply changes | 167 s |
Encoded document | 16 MB |
Memory usage | 466 MB |
Loading to memory | 2.2 s |
Offline, p2p over WebRTC, collaboration with change-tracking support!
Demo
Live Demo with a large Audience: FOSDEM
Yjs in the Real World
Applications that use Yjs
- Pluxbox (2017)
- Nimbus Notes
- Room.sh
- Legend Keeper
- Relm.us
Yjs Ecosystem
- Quill
- ProseMirror
- CodeMirror 5 & 6
- Monaco
- TipTap
- Atlaskit Editor
- Remirror
- Slate
- y-websocket
- y-webrtc
- y-dat
- y-indexeddb
- y-leveldb
- y-redis
- y-mongodb
Full overview: docs.yjs.dev
- MobY
- zustand-yjs
- svelt-yjs
Editor Support
Connection Provider
Database Provider
Application State

twitter.com/kevin_jahns
Copy of deck
By Kevin Jahns
Copy of deck
- 268