loro-crdt 1.13.3 → 1.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.13.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 4d577ad: Fix two O(n^2) editing slowdowns.
8
+
9
+ 1. Editing with UTF-16 / UTF-8 (byte) positions (the default in the JS binding)
10
+ validated each position by materializing the entire `[0, pos)` prefix string,
11
+ making every `insert`/`delete`/`splice`/`mark` O(n) and a run of edits O(n^2)
12
+ (regression since 1.12.0). The boundary check now reads the rope's prefix
13
+ caches via the cursor (O(log n)). Unicode-indexed editing was unaffected.
14
+ 2. When a subscriber is attached and many edits land on the same container within
15
+ one event batch (e.g. random-position inserts, or many distinct map-key
16
+ writes), building the event cloned the growing accumulated diff on every
17
+ compose — O(n^2) in the number of fragments. The diffs are now composed in
18
+ place. This affected text, map and list events.
19
+ 3. Converting a UTF-16 / UTF-8 position within a text chunk to a unicode offset
20
+ scanned the chunk char-by-char, so editing/slicing a large contiguous chunk
21
+ (a big insert, a loaded document, or a long run of typed text that merges into
22
+ one chunk) was O(chunk length) per op. Chunks that contain no astral-plane
23
+ characters (UTF-16) or are pure ASCII (UTF-8) now convert in O(1), covering
24
+ essentially all real-world text (ASCII/Latin/CJK).
25
+
3
26
  ## 1.13.3
4
27
 
5
28
  ### Patch Changes