@pmate/chat-sdk 0.13.0-profile.11 → 0.13.0-profile.12
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 +10 -0
- package/lib/runtime/profileWindows.d.ts +2 -0
- package/lib/runtime/profileWindows.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -411,3 +411,13 @@ Worker recovery keeps the same prepared UI store until its replacement snapshot
|
|
|
411
411
|
is validated; it must not call the final disposal path. Direct memory-store users
|
|
412
412
|
may call `dispose()` when permanently discarding that Profile. This release does
|
|
413
413
|
not claim that process RSS immediately falls or resolve all recovery peak memory.
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
### Sparse Window paging (0.13.0-profile.12)
|
|
417
|
+
|
|
418
|
+
Organizing messages may leave many empty sealed Windows. Their identities and
|
|
419
|
+
historical routing boundaries remain durable, while the in-memory page directory
|
|
420
|
+
now indexes only nonempty blocks. Reading a small page no longer walks intervening
|
|
421
|
+
empty block contents. A 10,002-Window regression with only two populated blocks
|
|
422
|
+
checks older/newer anchors, retained block identities and forked directories.
|
|
423
|
+
No storage schema or Window merge behavior changes.
|
|
@@ -15,6 +15,8 @@ export declare class ProfileWindowDirectory {
|
|
|
15
15
|
private baseLookup?;
|
|
16
16
|
private removed;
|
|
17
17
|
private offsets;
|
|
18
|
+
private pageWindows;
|
|
19
|
+
private pageOffsets;
|
|
18
20
|
private size;
|
|
19
21
|
constructor(generation: string, threadId: string, windows?: readonly ProfileWindow[]);
|
|
20
22
|
get count(): number;
|
|
@@ -28,6 +28,8 @@ export class ProfileWindowDirectory {
|
|
|
28
28
|
baseLookup;
|
|
29
29
|
removed = new Set();
|
|
30
30
|
offsets = [];
|
|
31
|
+
pageWindows = [];
|
|
32
|
+
pageOffsets = [];
|
|
31
33
|
size = 0;
|
|
32
34
|
constructor(generation, threadId, windows = []) {
|
|
33
35
|
this.generation = generation;
|
|
@@ -138,8 +140,14 @@ export class ProfileWindowDirectory {
|
|
|
138
140
|
reindex() {
|
|
139
141
|
this.size = 0;
|
|
140
142
|
this.offsets = [];
|
|
143
|
+
this.pageWindows = [];
|
|
144
|
+
this.pageOffsets = [];
|
|
141
145
|
for (const window of this.windows) {
|
|
142
146
|
this.offsets.push(this.size);
|
|
147
|
+
if (window.refs.length) {
|
|
148
|
+
this.pageWindows.push(window);
|
|
149
|
+
this.pageOffsets.push(this.size);
|
|
150
|
+
}
|
|
143
151
|
this.size += window.refs.length;
|
|
144
152
|
}
|
|
145
153
|
}
|
|
@@ -163,10 +171,12 @@ export class ProfileWindowDirectory {
|
|
|
163
171
|
const end = direction === "older" ? position : Math.min(this.size, start + limit);
|
|
164
172
|
if (start >= end)
|
|
165
173
|
return [];
|
|
166
|
-
|
|
174
|
+
// Empty sealed blocks keep historical routing boundaries, but must not
|
|
175
|
+
// turn a small page into a scan across all previously organized windows.
|
|
176
|
+
let block = Math.max(0, lowerBound(this.pageOffsets, offset => offset - (start + 1)) - 1);
|
|
167
177
|
const result = [];
|
|
168
|
-
while (block < this.
|
|
169
|
-
const offset = this.
|
|
178
|
+
while (block < this.pageWindows.length && this.pageOffsets[block] < end) {
|
|
179
|
+
const offset = this.pageOffsets[block], refs = this.pageWindows[block].refs;
|
|
170
180
|
result.push(...refs.slice(Math.max(0, start - offset), Math.min(refs.length, end - offset)));
|
|
171
181
|
block++;
|
|
172
182
|
}
|
package/package.json
CHANGED