@sovereignbase/sequencer 0.0.0 → 0.0.2
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/README.md +50 -28
- package/dist/index.cjs +218 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +10 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +218 -74
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -25,44 +25,43 @@ lifecycle workload and API throughput bursts. Full results are available for
|
|
|
25
25
|
[lifecycle](benchmark/.results/lifecycle.md) and
|
|
26
26
|
[throughput](benchmark/.results/throughput.md).
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
Current throughput results, measured on 12 October 2026. Latencies are in µs per
|
|
29
29
|
public API call, weighted by call count across three runs.
|
|
30
30
|
|
|
31
|
-
| Operation | 100 initial
|
|
32
|
-
| ----------------------------------- |
|
|
33
|
-
| `new Projection(actorID, sequence)` |
|
|
34
|
-
| `insert`, random position |
|
|
35
|
-
| `remove`, middle |
|
|
36
|
-
| `replace`, middle |
|
|
37
|
-
| `sequence()` |
|
|
38
|
-
| `value`, random position |
|
|
39
|
-
| `values()` |
|
|
31
|
+
| Operation | 100 initial insertions | 1,000 initial insertions | 10,000 initial insertions |
|
|
32
|
+
| ----------------------------------- | ---------------------: | -----------------------: | ------------------------: |
|
|
33
|
+
| `new Projection(actorID, sequence)` | 2.013 | 1.598 | 1.503 |
|
|
34
|
+
| `insert`, random position | 1.108 | 1.045 | 1.076 |
|
|
35
|
+
| `remove`, middle | 1.534 | 1.605 | 1.493 |
|
|
36
|
+
| `replace`, middle | 1.507 | 1.364 | 1.625 |
|
|
37
|
+
| `sequence()` | 0.288 | 0.320 | 0.331 |
|
|
38
|
+
| `value`, random position | 0.090 | 0.082 | 0.155 |
|
|
39
|
+
| `values()` | 4.787 | 174.213 | 1252.987 |
|
|
40
40
|
|
|
41
41
|
Environment: Node 24.16.0, V8 13.6.233.17-node.49, Windows x64, Intel Core
|
|
42
42
|
i5-10210U. Generated Strip lengths are 1–100 Frames. Each case warms up for
|
|
43
|
-
|
|
43
|
+
2,048 calls, then measures a burst of approximately 100 ms or at most 8,192 calls.
|
|
44
44
|
|
|
45
45
|
## Memory efficiency
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Retained memory for eight Projections, each containing 6,000 consecutive
|
|
48
|
+
single-Frame insertions. These are five-run medians from isolated Node processes:
|
|
48
49
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
50
|
+
| Measurement | Current |
|
|
51
|
+
| --------------------------- | -------: |
|
|
52
|
+
| Additional JS heap after GC | 0.501 MB |
|
|
53
|
+
| Shared WASM memory capacity | 1.049 MB |
|
|
53
54
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
and external allocations, not whole-process RSS. WASM starts with 1 MiB of memory
|
|
58
|
-
and grows as needed.
|
|
55
|
+
Module import and a small warm-up are excluded from the heap delta. WASM
|
|
56
|
+
capacity includes the initial 1 MiB allocation. These are not process RSS or
|
|
57
|
+
per-Projection total memory.
|
|
59
58
|
|
|
60
59
|
### Moderate bundle size
|
|
61
60
|
|
|
62
61
|
| Format | Raw | Minified | Minified + gzip |
|
|
63
62
|
| -------- | -------: | -------: | --------------: |
|
|
64
|
-
| ESM |
|
|
65
|
-
| CommonJS |
|
|
63
|
+
| ESM | 120.9 kB | 101.6 kB | 36.8 kB |
|
|
64
|
+
| CommonJS | 121.0 kB | 102.4 kB | 37.0 kB |
|
|
66
65
|
|
|
67
66
|
Both bundles include the WASM module. Minified sizes use Terser with three
|
|
68
67
|
compression passes; source maps and type declarations are excluded. kB and MB
|
|
@@ -75,18 +74,39 @@ framing or content. Numeric metadata accepts `Uint32Array` and JSON numeric
|
|
|
75
74
|
arrays. Generic content, called Footage, stays in JavaScript; only numeric
|
|
76
75
|
metadata enters WASM.
|
|
77
76
|
|
|
77
|
+
`sequence()` returns `[words, footage]`: one numeric array and one content
|
|
78
|
+
array, with no nested insertion or acknowledgement arrays. Small snapshots use
|
|
79
|
+
six-word records after length-prefixed acknowledgements. From 64 retained
|
|
80
|
+
insertions onward, predictable fields are omitted as WASM writes the snapshot;
|
|
81
|
+
`[0, frontiersEnd, insertionCount]` identifies this compact numeric layout.
|
|
82
|
+
Coordinates, acknowledgements and content order are preserved. The runtime
|
|
83
|
+
reads both layouts; compact snapshots require an updated reader.
|
|
84
|
+
Positive insertion lengths identify successive spans of `footage`.
|
|
85
|
+
An empty Sequence is `[[], []]`. Construction and `merge()` accept numeric
|
|
86
|
+
arrays or `Uint32Array` metadata; exported numeric arrays can be sent as JSON.
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
const retained = projection.sequence()
|
|
90
|
+
const restored = new Projection<string>(2, retained)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Consecutive local insertions extend an intact insertion from the same Session
|
|
94
|
+
without reserving another zero in its logical clock. Gossip contains only the
|
|
95
|
+
new suffix, still using six structural words. A removal or fragmentation ends
|
|
96
|
+
the local extension chain. Retained snapshots remain unchanged by later edits.
|
|
97
|
+
|
|
78
98
|
Measured JSON transport sizes for 1,000 one-Frame insertions containing `'x'`,
|
|
79
99
|
their removal Gossip, and a snapshot captured before removal:
|
|
80
100
|
|
|
81
101
|
| Workload | Average bytes per operation or insertion | JSON | JSON + gzip | gzip reduction |
|
|
82
102
|
| ---------------------------------------------- | ---------------------------------------: | ------: | ----------: | -------------: |
|
|
83
|
-
| 1,000 one-frame insertions | 44.
|
|
84
|
-
| 1,000 one-frame removals | 65.
|
|
85
|
-
| Snapshot containing 1,000 one-frame insertions |
|
|
103
|
+
| 1,000 one-frame insertions | 44.8 B | 45.8 kB | 5.1 kB | 88.9% |
|
|
104
|
+
| 1,000 one-frame removals | 65.8 B | 66.8 kB | 7.5 kB | 88.8% |
|
|
105
|
+
| Snapshot containing 1,000 one-frame insertions | 4.0 B | 4.0 kB | 0.1 kB | 98.3% |
|
|
86
106
|
|
|
87
107
|
Gossip sizes include acknowledgements and content where present. Delta averages
|
|
88
108
|
measure individual Gossip packets; batch totals include their enclosing array.
|
|
89
|
-
Snapshot averages divide the complete Sequence size by
|
|
109
|
+
Snapshot averages divide the complete Sequence size by the 1,000 authored insertions. Consecutive insertions are retained as one insertion.
|
|
90
110
|
Sizes vary with Session IDs and content.
|
|
91
111
|
|
|
92
112
|
## Tests
|
|
@@ -97,7 +117,9 @@ Sizes vary with Session IDs and content.
|
|
|
97
117
|
typechecks tests, runs unit, convergence, integration and generative stress suites
|
|
98
118
|
with V8 coverage, then runs runtime and browser compatibility checks.
|
|
99
119
|
|
|
100
|
-
The latest verification passed
|
|
120
|
+
The latest verification passed 170 Vitest tests and 88 compatibility checks.
|
|
121
|
+
The configured 100% coverage threshold remains unmet (95.66% statements,
|
|
122
|
+
94.94% branches, 100% functions, 97.23% lines).
|
|
101
123
|
Convergence tests include 1,024 generated editing histories for each compaction
|
|
102
124
|
mode. See the [test suites](test/README.md) and
|
|
103
125
|
[automated test report](https://sovereignbase.dev/sequencer/tests/).
|