@sovereignbase/sequencer 1.1.1 → 1.2.0
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 +92 -36
- package/dist/index.cjs +41 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -13
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +22 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +41 -33
- package/dist/index.js.map +1 -1
- package/package.json +22 -15
package/README.md
CHANGED
|
@@ -50,6 +50,20 @@ projectionA.destroy()
|
|
|
50
50
|
projectionB.destroy()
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### Tuple mode
|
|
54
|
+
|
|
55
|
+
Each index represents an independent slot. Adding or removing values
|
|
56
|
+
never shifts other values. Empty slots return `undefined`.
|
|
57
|
+
|
|
58
|
+
Omit `maxLength` to allow dynamic growth.
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
const tuple = new Projection<string>(1, undefined, { enabled: 1, maxLength: 4 })
|
|
62
|
+
tuple.insert(['hello'], 2)
|
|
63
|
+
tuple.replace(['world'], 2, 2)
|
|
64
|
+
tuple.remove(2, 2)
|
|
65
|
+
```
|
|
66
|
+
|
|
53
67
|
### See documentation
|
|
54
68
|
|
|
55
69
|
- [How sequencer works?](INTERNALS.md)
|
|
@@ -73,8 +87,8 @@ Invalid input to `apply()` or `merge()` returns `undefined` instead of throwing.
|
|
|
73
87
|
|
|
74
88
|
| Format | Raw (KiB) | Minified (KiB) | Minified + gzip (KiB) |
|
|
75
89
|
| -------- | --------: | -------------: | --------------------: |
|
|
76
|
-
| ESM |
|
|
77
|
-
| CommonJS |
|
|
90
|
+
| ESM | 158.96 | 129.47 | 46.18 |
|
|
91
|
+
| CommonJS | 159.10 | 130.50 | 46.26 |
|
|
78
92
|
|
|
79
93
|
Both bundles include WASM. Terser uses three compression passes; gzip uses level 9.
|
|
80
94
|
|
|
@@ -87,37 +101,37 @@ Strips contain 1–100 Frames (visible entries). Headers show Strip counts and m
|
|
|
87
101
|
|
|
88
102
|
| Method / case | 1,000 Strips<br>50,871 Frames | 5,000 Strips<br>252,214 Frames | 10,000 Strips<br>504,871 Frames | 15,000 Strips<br>758,280 Frames | 20,000 Strips<br>1,010,749 Frames | 25,000 Strips<br>1,264,003 Frames |
|
|
89
103
|
| -------------- | ----------------------------: | -----------------------------: | ------------------------------: | ------------------------------: | --------------------------------: | --------------------------------: |
|
|
90
|
-
| apply.random |
|
|
91
|
-
| insert.head | 1,
|
|
92
|
-
| insert.random |
|
|
93
|
-
| insert.tail | 1,
|
|
104
|
+
| apply.random | 165,146 | 80,297 | 54,380 | 41,110 | 33,538 | 28,291 |
|
|
105
|
+
| insert.head | 1,122,612 | 837,202 | 921,657 | 958,738 | 972,684 | 965,626 |
|
|
106
|
+
| insert.random | 450,279 | 221,686 | 139,522 | 105,715 | 84,912 | 70,984 |
|
|
107
|
+
| insert.tail | 1,257,918 | 966,648 | 1,068,075 | 1,110,791 | 1,125,900 | 1,120,143 |
|
|
94
108
|
| remove.head | — | — | — | — | — | — |
|
|
95
|
-
| remove.random |
|
|
109
|
+
| remove.random | 321,595 | 152,089 | 97,386 | 73,599 | 58,548 | 48,596 |
|
|
96
110
|
| remove.tail | — | — | — | — | — | — |
|
|
97
|
-
| replace.head |
|
|
98
|
-
| replace.random |
|
|
99
|
-
| replace.tail |
|
|
100
|
-
| value.head | 2,
|
|
101
|
-
| value.random |
|
|
102
|
-
| value.tail |
|
|
111
|
+
| replace.head | 443,538 | 372,326 | 387,006 | 380,137 | 368,832 | 377,323 |
|
|
112
|
+
| replace.random | 277,133 | 139,536 | 93,692 | 69,874 | 56,537 | 46,830 |
|
|
113
|
+
| replace.tail | 396,605 | 384,577 | 367,733 | 388,662 | 373,868 | 326,906 |
|
|
114
|
+
| value.head | 2,434,405 | 3,017,725 | 3,159,921 | 3,255,278 | 3,353,882 | 3,376,975 |
|
|
115
|
+
| value.random | 648,315 | 219,859 | 123,644 | 86,005 | 67,010 | 54,747 |
|
|
116
|
+
| value.tail | 4,638,685 | 4,700,677 | 4,599,267 | 4,489,616 | 4,427,938 | 4,335,579 |
|
|
103
117
|
|
|
104
118
|
**↓ Scale down (25,000 → 0 Strips)**
|
|
105
119
|
|
|
106
120
|
| Method / case | 20,000 Strips<br>1,012,742 Frames | 15,000 Strips<br>755,860 Frames | 10,000 Strips<br>504,103 Frames | 5,000 Strips<br>251,203 Frames | 1,000 Strips<br>51,057 Frames | 0 Strips<br>0 Frames |
|
|
107
121
|
| -------------- | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
108
|
-
| apply.random |
|
|
122
|
+
| apply.random | 17,938 | 17,713 | 17,324 | 17,192 | 17,475 | 17,723 |
|
|
109
123
|
| insert.head | — | — | — | — | — | — |
|
|
110
|
-
| insert.random |
|
|
124
|
+
| insert.random | 43,876 | 43,789 | 43,227 | 42,155 | 43,057 | 42,481 |
|
|
111
125
|
| insert.tail | — | — | — | — | — | — |
|
|
112
|
-
| remove.head |
|
|
113
|
-
| remove.random |
|
|
114
|
-
| remove.tail |
|
|
115
|
-
| replace.head |
|
|
116
|
-
| replace.random |
|
|
117
|
-
| replace.tail |
|
|
118
|
-
| value.head |
|
|
119
|
-
| value.random |
|
|
120
|
-
| value.tail |
|
|
126
|
+
| remove.head | 463,595 | 461,812 | 464,125 | 465,124 | 465,532 | 468,318 |
|
|
127
|
+
| remove.random | 31,986 | 32,761 | 33,073 | 33,589 | 34,651 | 35,236 |
|
|
128
|
+
| remove.tail | 458,417 | 441,961 | 453,605 | 457,641 | 460,637 | 426,206 |
|
|
129
|
+
| replace.head | 344,742 | 332,817 | 326,516 | 286,836 | 275,906 | 220,054 |
|
|
130
|
+
| replace.random | 31,740 | 32,287 | 32,489 | 32,466 | 33,449 | 33,035 |
|
|
131
|
+
| replace.tail | 177,741 | 160,539 | 153,018 | 138,043 | 135,883 | 120,041 |
|
|
132
|
+
| value.head | 1,601,558 | 1,562,009 | 1,528,923 | 1,523,295 | 1,556,207 | 1,574,242 |
|
|
133
|
+
| value.random | 35,753 | 36,152 | 36,317 | 36,833 | 37,989 | 38,814 |
|
|
134
|
+
| value.tail | 1,851,210 | 1,782,579 | 1,751,515 | 1,748,210 | 1,784,081 | 1,809,761 |
|
|
121
135
|
|
|
122
136
|
### API throughput at checkpoint
|
|
123
137
|
|
|
@@ -127,17 +141,17 @@ Checkpoint calls, in ops/s, averaged across runs.
|
|
|
127
141
|
|
|
128
142
|
| Method | 1,000 Strips<br>50,871 Frames | 5,000 Strips<br>252,214 Frames | 10,000 Strips<br>504,871 Frames | 15,000 Strips<br>758,280 Frames | 20,000 Strips<br>1,010,749 Frames | 25,000 Strips<br>1,264,003 Frames |
|
|
129
143
|
| --------------------------------- | ----------------------------: | -----------------------------: | ------------------------------: | ------------------------------: | --------------------------------: | --------------------------------: |
|
|
130
|
-
| new Projection(actorID, sequence) | 4,
|
|
131
|
-
| sequence() |
|
|
132
|
-
| values() |
|
|
144
|
+
| new Projection(actorID, sequence) | 4,095 | 879 | 555 | 368 | 269 | 231 |
|
|
145
|
+
| sequence() | 522 | 79 | 42 | 27 | 19 | 12 |
|
|
146
|
+
| values() | 594 | 182 | 52 | 64 | 25 | 42 |
|
|
133
147
|
|
|
134
148
|
**↓ Scale down (25,000 → 0 Strips)**
|
|
135
149
|
|
|
136
150
|
| Method | 20,000 Strips<br>1,012,742 Frames | 15,000 Strips<br>755,860 Frames | 10,000 Strips<br>504,103 Frames | 5,000 Strips<br>251,203 Frames | 1,000 Strips<br>51,057 Frames | 0 Strips<br>0 Frames |
|
|
137
151
|
| --------------------------------- | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
138
|
-
| new Projection(actorID, sequence) |
|
|
139
|
-
| sequence() |
|
|
140
|
-
| values() |
|
|
152
|
+
| new Projection(actorID, sequence) | 266 | 386 | 479 | 1,167 | 4,991 | 18,336 |
|
|
153
|
+
| sequence() | 13 | 12 | 7 | 8 | 7 | 7 |
|
|
154
|
+
| values() | 43 | 41 | 59 | 76 | 204 | 87,032 |
|
|
141
155
|
|
|
142
156
|
### Sequence disk size at checkpoint
|
|
143
157
|
|
|
@@ -147,8 +161,8 @@ Complete exported Sequences, including Footage and acknowledgements. Sizes are i
|
|
|
147
161
|
|
|
148
162
|
| Encoding | 1,000 Strips<br>50,871 Frames | 5,000 Strips<br>252,214 Frames | 10,000 Strips<br>504,871 Frames | 15,000 Strips<br>758,280 Frames | 20,000 Strips<br>1,010,749 Frames | 25,000 Strips<br>1,264,003 Frames |
|
|
149
163
|
| ------------------ | ----------------------------: | -----------------------------: | ------------------------------: | ------------------------------: | --------------------------------: | --------------------------------: |
|
|
150
|
-
| JSON | 277.
|
|
151
|
-
| JSON + gzip | 14.60 | 73.
|
|
164
|
+
| JSON | 277.29 | 1,622.20 | 3,262.86 | 4,902.77 | 7,043.50 | 9,165.60 |
|
|
165
|
+
| JSON + gzip | 14.60 | 73.85 | 150.43 | 226.96 | 311.21 | 391.70 |
|
|
152
166
|
| MessagePack | 164.81 | 818.88 | 1,639.69 | 3,529.41 | 5,081.04 | 6,483.22 |
|
|
153
167
|
| MessagePack + gzip | 12.38 | 61.62 | 124.91 | 198.59 | 263.54 | 332.77 |
|
|
154
168
|
|
|
@@ -156,8 +170,8 @@ Complete exported Sequences, including Footage and acknowledgements. Sizes are i
|
|
|
156
170
|
|
|
157
171
|
| Encoding | 20,000 Strips<br>1,012,742 Frames | 15,000 Strips<br>755,860 Frames | 10,000 Strips<br>504,103 Frames | 5,000 Strips<br>251,203 Frames | 1,000 Strips<br>51,057 Frames | 0 Strips<br>0 Frames |
|
|
158
172
|
| ------------------ | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
159
|
-
| JSON | 7,
|
|
160
|
-
| JSON + gzip | 323.
|
|
173
|
+
| JSON | 7,449.19 | 5,619.45 | 3,771.17 | 1,886.19 | 383.37 | 0.02 |
|
|
174
|
+
| JSON + gzip | 323.26 | 244.47 | 163.94 | 80.65 | 16.34 | 0.03 |
|
|
161
175
|
| MessagePack | 5,237.17 | 3,930.33 | 2,628.38 | 1,312.43 | 266.67 | 0.01 |
|
|
162
176
|
| MessagePack + gzip | 274.96 | 207.78 | 137.38 | 67.41 | 13.67 | 0.03 |
|
|
163
177
|
|
|
@@ -177,16 +191,58 @@ One instance: WASM memory plus retained JS array slots, in KiB (1,024 bytes).
|
|
|
177
191
|
| ---------------------- | --------------------------------: | ------------------------------: | ------------------------------: | -----------------------------: | ----------------------------: | -------------------: |
|
|
178
192
|
| Estimated memory (KiB) | 163,746.93 | 174,034.00 | 202,660.72 | 293,941.85 | 302,158.29 | 304,203.30 |
|
|
179
193
|
|
|
180
|
-
Measured on Node 24.
|
|
194
|
+
Measured on Node 24.22.2, V8 13.6.233.17-node.63,
|
|
181
195
|
linux x64, AMD EPYC 7763 64-Core Processor.
|
|
182
196
|
Peer synchronization, encoding and JS process garbage collection are outside API timings.
|
|
183
197
|
[Full lifecycle results](benchmark/.results/lifecycle.md) · [Throughput results](benchmark/.results/throughput.md).
|
|
184
198
|
|
|
199
|
+
### Tuple mode
|
|
200
|
+
|
|
201
|
+
Arithmetic means of 3 runs. Ordinary Projection versus a static tuple with maxLength. Both contain the same values; replacements preserve the field count.
|
|
202
|
+
|
|
203
|
+
#### Throughput (ops/s)
|
|
204
|
+
|
|
205
|
+
| Indices | Method / case | Projection | Static tuple | Tuple / Projection |
|
|
206
|
+
| ------: | --------------- | ---------: | -----------: | -----------------: |
|
|
207
|
+
| 2 | create.sequence | 666,485 | 589,182 | 0.88× |
|
|
208
|
+
| 2 | replace.random | 713,174 | 1,115,805 | 1.56× |
|
|
209
|
+
| 2 | apply.replace | 508,935 | 700,611 | 1.38× |
|
|
210
|
+
| 2 | value.random | 30,174,106 | 48,218,497 | 1.60× |
|
|
211
|
+
| 4 | create.sequence | 458,897 | 519,633 | 1.13× |
|
|
212
|
+
| 4 | replace.random | 735,182 | 1,138,983 | 1.55× |
|
|
213
|
+
| 4 | apply.replace | 417,043 | 707,797 | 1.70× |
|
|
214
|
+
| 4 | value.random | 26,113,205 | 50,651,808 | 1.94× |
|
|
215
|
+
| 8 | create.sequence | 349,073 | 425,121 | 1.22× |
|
|
216
|
+
| 8 | replace.random | 709,998 | 1,128,141 | 1.59× |
|
|
217
|
+
| 8 | apply.replace | 412,048 | 735,958 | 1.79× |
|
|
218
|
+
| 8 | value.random | 19,625,431 | 50,234,180 | 2.56× |
|
|
219
|
+
| 100 | create.sequence | 69,823 | 98,188 | 1.41× |
|
|
220
|
+
| 100 | replace.random | 697,750 | 1,214,212 | 1.74× |
|
|
221
|
+
| 100 | apply.replace | 323,195 | 751,943 | 2.33× |
|
|
222
|
+
| 100 | value.random | 8,758,041 | 49,605,873 | 5.66× |
|
|
223
|
+
|
|
224
|
+
#### Space (KiB)
|
|
225
|
+
|
|
226
|
+
| Indices | Mode | Estimated allocated memory | MessagePack | MessagePack + gzip |
|
|
227
|
+
| ------: | ------------ | -------------------------: | ----------: | -----------------: |
|
|
228
|
+
| 2 | Projection | 0.98 | 0.03 | 0.04 |
|
|
229
|
+
| 2 | Static tuple | 0.90 | 0.04 | 0.05 |
|
|
230
|
+
| 4 | Projection | 1.57 | 0.06 | 0.05 |
|
|
231
|
+
| 4 | Static tuple | 1.09 | 0.06 | 0.07 |
|
|
232
|
+
| 8 | Projection | 2.52 | 0.12 | 0.08 |
|
|
233
|
+
| 8 | Static tuple | 1.55 | 0.10 | 0.09 |
|
|
234
|
+
| 100 | Projection | 23.78 | 0.67 | 0.57 |
|
|
235
|
+
| 100 | Static tuple | 12.23 | 0.51 | 0.35 |
|
|
236
|
+
|
|
237
|
+
Measured on Node 24.22.2, V8 13.6.233.17-node.63, linux x64, AMD EPYC 7763 64-Core Processor. Fixtures are hydrated compacted snapshots after one replacement per field. Each case warms up for ≥25 ms and measures ≥50 ms of API time; mutation bursts restart after 4,096 replacements. Peer authoring, encoding, result checks, destruction and explicit JS process garbage collection are outside API timings. Memory estimates are the increase in live native allocator bytes plus retained JS array slots for one instance, including exercised runtime buffers. Unused WASM capacity, JS object headers and referenced payload objects are excluded.
|
|
238
|
+
|
|
239
|
+
[Full tuple results](benchmark/.results/tuple.md).
|
|
240
|
+
|
|
185
241
|
## Tests
|
|
186
242
|
|
|
187
243
|
### Behaviour guaranteed by excessive tests
|
|
188
244
|
|
|
189
|
-
The latest verification passed
|
|
245
|
+
The latest verification passed 271 Vitest tests and 117 compatibility checks.
|
|
190
246
|
The configured 100% coverage threshold is met (100% statements, 100% branches, 100% functions, 100% lines).
|
|
191
247
|
See the [test suites](test/README.md) and
|
|
192
248
|
[automated test report](https://sovereignbase.dev/sequencer/tests/).
|