@elaraai/east 1.0.79 → 1.0.80
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 +1 -1
- package/dist/src/comparison.d.ts.map +1 -1
- package/dist/src/comparison.js +4 -5
- package/dist/src/comparison.js.map +1 -1
- package/dist/src/compile/builtins/array.d.ts +59 -0
- package/dist/src/compile/builtins/array.d.ts.map +1 -0
- package/dist/src/compile/builtins/array.js +656 -0
- package/dist/src/compile/builtins/array.js.map +1 -0
- package/dist/src/compile/builtins/blob.d.ts +18 -0
- package/dist/src/compile/builtins/blob.d.ts.map +1 -0
- package/dist/src/compile/builtins/blob.js +150 -0
- package/dist/src/compile/builtins/blob.js.map +1 -0
- package/dist/src/compile/builtins/compare.d.ts +18 -0
- package/dist/src/compile/builtins/compare.d.ts.map +1 -0
- package/dist/src/compile/builtins/compare.js +52 -0
- package/dist/src/compile/builtins/compare.js.map +1 -0
- package/dist/src/compile/builtins/datetime.d.ts +21 -0
- package/dist/src/compile/builtins/datetime.d.ts.map +1 -0
- package/dist/src/compile/builtins/datetime.js +46 -0
- package/dist/src/compile/builtins/datetime.js.map +1 -0
- package/dist/src/compile/builtins/dict.d.ts +46 -0
- package/dist/src/compile/builtins/dict.d.ts.map +1 -0
- package/dist/src/compile/builtins/dict.js +551 -0
- package/dist/src/compile/builtins/dict.js.map +1 -0
- package/dist/src/compile/builtins/index.d.ts +9 -0
- package/dist/src/compile/builtins/index.d.ts.map +1 -0
- package/dist/src/compile/builtins/index.js +28 -0
- package/dist/src/compile/builtins/index.js.map +1 -0
- package/dist/src/compile/builtins/matrix.d.ts +31 -0
- package/dist/src/compile/builtins/matrix.d.ts.map +1 -0
- package/dist/src/compile/builtins/matrix.js +310 -0
- package/dist/src/compile/builtins/matrix.js.map +1 -0
- package/dist/src/compile/builtins/primitives.d.ts +36 -0
- package/dist/src/compile/builtins/primitives.d.ts.map +1 -0
- package/dist/src/compile/builtins/primitives.js +67 -0
- package/dist/src/compile/builtins/primitives.js.map +1 -0
- package/dist/src/compile/builtins/ref.d.ts +11 -0
- package/dist/src/compile/builtins/ref.d.ts.map +1 -0
- package/dist/src/compile/builtins/ref.js +30 -0
- package/dist/src/compile/builtins/ref.js.map +1 -0
- package/dist/src/compile/builtins/set.d.ts +41 -0
- package/dist/src/compile/builtins/set.d.ts.map +1 -0
- package/dist/src/compile/builtins/set.js +385 -0
- package/dist/src/compile/builtins/set.js.map +1 -0
- package/dist/src/compile/builtins/sparse.d.ts +19 -0
- package/dist/src/compile/builtins/sparse.d.ts.map +1 -0
- package/dist/src/compile/builtins/sparse.js +143 -0
- package/dist/src/compile/builtins/sparse.js.map +1 -0
- package/dist/src/compile/builtins/string.d.ts +34 -0
- package/dist/src/compile/builtins/string.d.ts.map +1 -0
- package/dist/src/compile/builtins/string.js +238 -0
- package/dist/src/compile/builtins/string.js.map +1 -0
- package/dist/src/compile/builtins/vector.d.ts +44 -0
- package/dist/src/compile/builtins/vector.d.ts.map +1 -0
- package/dist/src/compile/builtins/vector.js +463 -0
- package/dist/src/compile/builtins/vector.js.map +1 -0
- package/dist/src/compile/constructors.d.ts +13 -0
- package/dist/src/compile/constructors.d.ts.map +1 -0
- package/dist/src/compile/constructors.js +179 -0
- package/dist/src/compile/constructors.js.map +1 -0
- package/dist/src/compile/control.d.ts +13 -0
- package/dist/src/compile/control.d.ts.map +1 -0
- package/dist/src/compile/control.js +513 -0
- package/dist/src/compile/control.js.map +1 -0
- package/dist/src/compile/functions.d.ts +13 -0
- package/dist/src/compile/functions.d.ts.map +1 -0
- package/dist/src/compile/functions.js +492 -0
- package/dist/src/compile/functions.js.map +1 -0
- package/dist/src/compile/ir.d.ts +19 -0
- package/dist/src/compile/ir.d.ts.map +1 -0
- package/dist/src/compile/ir.js +193 -0
- package/dist/src/compile/ir.js.map +1 -0
- package/dist/src/compile/runtime.d.ts +78 -0
- package/dist/src/compile/runtime.d.ts.map +1 -0
- package/dist/src/compile/runtime.js +111 -0
- package/dist/src/compile/runtime.js.map +1 -0
- package/dist/src/compile/type_parameters.d.ts +4 -0
- package/dist/src/compile/type_parameters.d.ts.map +1 -0
- package/dist/src/compile/type_parameters.js +55 -0
- package/dist/src/compile/type_parameters.js.map +1 -0
- package/dist/src/compile/typed_arrays.d.ts +28 -0
- package/dist/src/compile/typed_arrays.d.ts.map +1 -0
- package/dist/src/compile/typed_arrays.js +77 -0
- package/dist/src/compile/typed_arrays.js.map +1 -0
- package/dist/src/compile.d.ts +6 -41
- package/dist/src/compile.d.ts.map +1 -1
- package/dist/src/compile.js +8 -4415
- package/dist/src/compile.js.map +1 -1
- package/dist/src/compile.open_beast.spec.js +5 -4
- package/dist/src/compile.open_beast.spec.js.map +1 -1
- package/dist/src/containers/sortedmap.d.ts +2 -1
- package/dist/src/containers/sortedmap.d.ts.map +1 -1
- package/dist/src/containers/sortedmap.js +4 -2
- package/dist/src/containers/sortedmap.js.map +1 -1
- package/dist/src/containers/sortedset.d.ts +2 -1
- package/dist/src/containers/sortedset.d.ts.map +1 -1
- package/dist/src/containers/sortedset.js +4 -2
- package/dist/src/containers/sortedset.js.map +1 -1
- package/dist/src/error.d.ts +15 -0
- package/dist/src/error.d.ts.map +1 -1
- package/dist/src/error.js +16 -0
- package/dist/src/error.js.map +1 -1
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/patch/index.d.ts +1 -1
- package/dist/src/patch/index.d.ts.map +1 -1
- package/dist/src/patch/index.js +1 -1
- package/dist/src/patch/index.js.map +1 -1
- package/dist/src/patch/type_of_patch.d.ts +25 -1
- package/dist/src/patch/type_of_patch.d.ts.map +1 -1
- package/dist/src/patch/type_of_patch.js +33 -10
- package/dist/src/patch/type_of_patch.js.map +1 -1
- package/dist/src/platform.spec.js +19 -1
- package/dist/src/platform.spec.js.map +1 -1
- package/dist/src/runner_protocol.d.ts +316 -0
- package/dist/src/runner_protocol.d.ts.map +1 -0
- package/dist/src/runner_protocol.js +135 -0
- package/dist/src/runner_protocol.js.map +1 -0
- package/dist/src/serialization/beast2/index.d.ts +21 -5
- package/dist/src/serialization/beast2/index.d.ts.map +1 -1
- package/dist/src/serialization/beast2/index.js +12 -2
- package/dist/src/serialization/beast2/index.js.map +1 -1
- package/dist/src/serialization/beast2/index.spec.js +84 -3
- package/dist/src/serialization/beast2/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/shared.d.ts +32 -3
- package/dist/src/serialization/beast2/shared.d.ts.map +1 -1
- package/dist/src/serialization/beast2/shared.js +135 -10
- package/dist/src/serialization/beast2/shared.js.map +1 -1
- package/dist/src/serialization/beast2/v4/container.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v4/container.js +5 -3
- package/dist/src/serialization/beast2/v4/container.js.map +1 -1
- package/dist/src/serialization/beast2/v5/aliasing.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/aliasing.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/aliasing.spec.js +75 -0
- package/dist/src/serialization/beast2/v5/aliasing.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.d.ts +176 -0
- package/dist/src/serialization/beast2/v5/boundary.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.js +297 -0
- package/dist/src/serialization/beast2/v5/boundary.js.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.js +479 -0
- package/dist/src/serialization/beast2/v5/boundary.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/codec.d.ts +6 -5
- package/dist/src/serialization/beast2/v5/codec.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/codec.js +18 -3
- package/dist/src/serialization/beast2/v5/codec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/deflate.d.ts +24 -2
- package/dist/src/serialization/beast2/v5/deflate.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/deflate.js +47 -12
- package/dist/src/serialization/beast2/v5/deflate.js.map +1 -1
- package/dist/src/serialization/beast2/v5/deflate.spec.js +15 -1
- package/dist/src/serialization/beast2/v5/deflate.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/elements.d.ts +64 -0
- package/dist/src/serialization/beast2/v5/elements.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.js +320 -0
- package/dist/src/serialization/beast2/v5/elements.js.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/elements.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/elements.spec.js +161 -0
- package/dist/src/serialization/beast2/v5/elements.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/frame-pool.d.ts +62 -21
- package/dist/src/serialization/beast2/v5/frame-pool.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frame-pool.js +138 -27
- package/dist/src/serialization/beast2/v5/frame-pool.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frame-pool.spec.js +198 -71
- package/dist/src/serialization/beast2/v5/frame-pool.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frame-worker.js +25 -15
- package/dist/src/serialization/beast2/v5/frame-worker.js.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.d.ts +22 -12
- package/dist/src/serialization/beast2/v5/frames.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/frames.js +52 -27
- package/dist/src/serialization/beast2/v5/frames.js.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.d.ts +38 -1
- package/dist/src/serialization/beast2/v5/geometry.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.js +73 -1
- package/dist/src/serialization/beast2/v5/geometry.js.map +1 -1
- package/dist/src/serialization/beast2/v5/geometry.spec.js +34 -23
- package/dist/src/serialization/beast2/v5/geometry.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/index.spec.js +32 -28
- package/dist/src/serialization/beast2/v5/index.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts +42 -1
- package/dist/src/serialization/beast2/v5/lazy.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.js +143 -28
- package/dist/src/serialization/beast2/v5/lazy.js.map +1 -1
- package/dist/src/serialization/beast2/v5/lazy.spec.js +102 -24
- package/dist/src/serialization/beast2/v5/lazy.spec.js.map +1 -1
- package/dist/src/serialization/beast2/v5/manifest-writer.d.ts +110 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.js +118 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.js.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.js +207 -0
- package/dist/src/serialization/beast2/v5/manifest-writer.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest.d.ts +241 -0
- package/dist/src/serialization/beast2/v5/manifest.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/manifest.js +233 -0
- package/dist/src/serialization/beast2/v5/manifest.js.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.d.ts +93 -0
- package/dist/src/serialization/beast2/v5/merge.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.js +202 -0
- package/dist/src/serialization/beast2/v5/merge.js.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/merge.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/merge.spec.js +118 -0
- package/dist/src/serialization/beast2/v5/merge.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.d.ts +143 -0
- package/dist/src/serialization/beast2/v5/recut.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.js +365 -0
- package/dist/src/serialization/beast2/v5/recut.js.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/recut.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/recut.spec.js +215 -0
- package/dist/src/serialization/beast2/v5/recut.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.d.ts +148 -0
- package/dist/src/serialization/beast2/v5/runs.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.js +260 -0
- package/dist/src/serialization/beast2/v5/runs.js.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/runs.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/runs.spec.js +182 -0
- package/dist/src/serialization/beast2/v5/runs.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.d.ts +19 -0
- package/dist/src/serialization/beast2/v5/sha256.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.js +103 -0
- package/dist/src/serialization/beast2/v5/sha256.js.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.d.ts +6 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.d.ts.map +1 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.js +42 -0
- package/dist/src/serialization/beast2/v5/sha256.spec.js.map +1 -0
- package/dist/src/serialization/beast2/v5/stream.d.ts +273 -86
- package/dist/src/serialization/beast2/v5/stream.d.ts.map +1 -1
- package/dist/src/serialization/beast2/v5/stream.js +576 -244
- package/dist/src/serialization/beast2/v5/stream.js.map +1 -1
- package/dist/src/serialization/beast2/v5/sync-reader.spec.js +24 -10
- package/dist/src/serialization/beast2/v5/sync-reader.spec.js.map +1 -1
- package/dist/src/serialization/index.d.ts +1 -1
- package/dist/src/serialization/index.d.ts.map +1 -1
- package/dist/src/serialization/index.js +1 -1
- package/dist/src/serialization/index.js.map +1 -1
- package/dist/src/serialization/json.d.ts +28 -0
- package/dist/src/serialization/json.d.ts.map +1 -1
- package/dist/src/serialization/json.js +141 -30
- package/dist/src/serialization/json.js.map +1 -1
- package/dist/src/serialization/json.spec.js +47 -2
- package/dist/src/serialization/json.spec.js.map +1 -1
- package/dist/src/serialization/json_schema.d.ts +15 -11
- package/dist/src/serialization/json_schema.d.ts.map +1 -1
- package/dist/src/serialization/json_schema.js +21 -36
- package/dist/src/serialization/json_schema.js.map +1 -1
- package/dist/src/serialization/json_schema.spec.js +26 -32
- package/dist/src/serialization/json_schema.spec.js.map +1 -1
- package/dist/src/serialization/json_schema_to_type.d.ts +10 -5
- package/dist/src/serialization/json_schema_to_type.d.ts.map +1 -1
- package/dist/src/serialization/json_schema_to_type.js +13 -6
- package/dist/src/serialization/json_schema_to_type.js.map +1 -1
- package/dist/src/serialization/json_schema_to_type.spec.js +19 -0
- package/dist/src/serialization/json_schema_to_type.spec.js.map +1 -1
- package/dist/src/string_order.d.ts +36 -0
- package/dist/src/string_order.d.ts.map +1 -0
- package/dist/src/string_order.js +64 -0
- package/dist/src/string_order.js.map +1 -0
- package/dist/src/string_order.spec.d.ts +6 -0
- package/dist/src/string_order.spec.d.ts.map +1 -0
- package/dist/src/string_order.spec.js +79 -0
- package/dist/src/string_order.spec.js.map +1 -0
- package/dist/src/type_of_type.d.ts +17 -0
- package/dist/src/type_of_type.d.ts.map +1 -1
- package/dist/src/type_of_type.js +66 -0
- package/dist/src/type_of_type.js.map +1 -1
- package/dist/src/type_of_type.to_etv.spec.js +69 -1
- package/dist/src/type_of_type.to_etv.spec.js.map +1 -1
- package/package.json +1 -1
|
@@ -13,11 +13,22 @@
|
|
|
13
13
|
*
|
|
14
14
|
* The writer's API is synchronous — {@link Beast2Writer.write} is called from
|
|
15
15
|
* inside compiled East bodies (the emit sink) — so results cannot come back as
|
|
16
|
-
* messages the main thread would have to yield to receive.
|
|
17
|
-
*
|
|
18
|
-
* out, and a status cell the worker flips and
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* messages the main thread would have to yield to receive. A frame instead
|
|
17
|
+
* travels through a slot: three `SharedArrayBuffer`s — the logical bytes in,
|
|
18
|
+
* the frame bytes out, and a status cell the worker flips and
|
|
19
|
+
* `Atomics.notify`s — handed to one worker once and reused by every frame
|
|
20
|
+
* after, grown only for a larger segment. The main thread polls the cell to
|
|
21
|
+
* append what is done and `Atomics.wait`s on it only when it must
|
|
22
|
+
* (back-pressure, a settle, `finish`).
|
|
23
|
+
*
|
|
24
|
+
* Nothing a frame allocates waits on a worker's garbage collector. A worker
|
|
25
|
+
* allocates almost nothing on its own heap, so its collector rarely runs — V8
|
|
26
|
+
* weighs buffers' memory towards a collection only after about 64 MiB of it per
|
|
27
|
+
* isolate — and fresh buffers shared per frame were held up to that much per
|
|
28
|
+
* worker (#841). The pool holds its slots: two segments' bytes for each frame in
|
|
29
|
+
* flight, and a writer keeps at most two in flight per worker. A slot grows by
|
|
30
|
+
* doubling, so the buffers it outgrew, which wait on that GC, come to less than
|
|
31
|
+
* it holds.
|
|
21
32
|
*
|
|
22
33
|
* Node-only and optional: without `worker_threads`, `SharedArrayBuffer` or a
|
|
23
34
|
* second CPU, {@link framePool} returns `null` and the writer frames inline,
|
|
@@ -25,11 +36,17 @@
|
|
|
25
36
|
* `process.getBuiltinModule` — as `frames.ts` reaches zlib — so browser
|
|
26
37
|
* bundles never see a `node:` import.
|
|
27
38
|
*
|
|
39
|
+
* A runner granted a number of threads caps the pool at that many workers
|
|
40
|
+
* ({@link configureFramePool}): a grant of one thread frames every write
|
|
41
|
+
* inline.
|
|
42
|
+
*
|
|
28
43
|
* A worker can die without flipping a status cell — a worker-thread OOM ends
|
|
29
44
|
* its isolate before its `catch` runs — and the main thread cannot receive the
|
|
30
45
|
* worker's `exit` event while it is blocked waiting on that worker's frame. So
|
|
31
46
|
* every wait is bounded: a frame pending past the wait timeout fails, the pool
|
|
32
|
-
* is abandoned, and the process frames inline from then on.
|
|
47
|
+
* is abandoned, and the process frames inline from then on. A worker's failure
|
|
48
|
+
* the main thread hears between writes — its `error` event — abandons the pool
|
|
49
|
+
* the same way, where unheard it would end the process.
|
|
33
50
|
*
|
|
34
51
|
* The pool is process-wide and outlives the write that started it, so a
|
|
35
52
|
* long-lived process — an API server, a terminal UI — would otherwise keep one
|
|
@@ -39,16 +56,9 @@
|
|
|
39
56
|
* frames, so it keeps the pool alive; the idle check is `unref`'d, so process
|
|
40
57
|
* exit is unaffected either way.
|
|
41
58
|
*/
|
|
42
|
-
import type
|
|
43
|
-
/** An upper bound on a frame's header: varint(codec) + varint(uncompressed
|
|
44
|
-
* length) + varint(payload length). A frame's payload never exceeds its
|
|
45
|
-
* logical bytes (`writeFrame` stores codec `none` when deflate does not
|
|
46
|
-
* shrink), so logical + this bounds a frame not yet written. */
|
|
47
|
-
export declare const FRAME_HEADER_MAX = 21;
|
|
59
|
+
import { type Beast2Codec } from "./frames.js";
|
|
48
60
|
/** A frame being deflated on a worker. */
|
|
49
61
|
export interface PendingFrame {
|
|
50
|
-
/** The logical bytes the frame carries — its payload's upper bound. */
|
|
51
|
-
readonly logicalLength: number;
|
|
52
62
|
/** Whether the frame is ready, without blocking. */
|
|
53
63
|
ready(): boolean;
|
|
54
64
|
/**
|
|
@@ -83,8 +93,12 @@ export interface FramePool {
|
|
|
83
93
|
*/
|
|
84
94
|
terminateWorkers(): Promise<void>;
|
|
85
95
|
}
|
|
86
|
-
/** The frame pool's
|
|
96
|
+
/** The frame pool's settings — see {@link configureFramePool}. */
|
|
87
97
|
export interface FramePoolSettings {
|
|
98
|
+
/** The most workers a pool starts — a runner's thread grant. Fewer than two
|
|
99
|
+
* frame every write inline. The pool never starts more workers than the
|
|
100
|
+
* CPUs the process may use, nor more than 32. */
|
|
101
|
+
workers?: number;
|
|
88
102
|
/** How long {@link PendingFrame.take} waits for one frame before it presumes
|
|
89
103
|
* the worker's thread lost, in milliseconds. */
|
|
90
104
|
waitTimeoutMs?: number;
|
|
@@ -96,18 +110,29 @@ export interface FramePoolSettings {
|
|
|
96
110
|
* The process's frame pool, created on first use — and again after an idle
|
|
97
111
|
* pool retired its workers.
|
|
98
112
|
*
|
|
99
|
-
* @returns the pool, or `null` when frames must be written inline —
|
|
100
|
-
* `worker_threads`, no `SharedArrayBuffer`, a
|
|
101
|
-
* (a pool per worker would only
|
|
102
|
-
* an earlier pool lost a worker
|
|
113
|
+
* @returns the pool, or `null` when frames must be written inline — a grant of
|
|
114
|
+
* fewer than two workers, no Node `worker_threads`, no `SharedArrayBuffer`, a
|
|
115
|
+
* single CPU, not the main thread (a pool per worker would only
|
|
116
|
+
* oversubscribe), worker start-up failed, or an earlier pool lost a worker
|
|
103
117
|
*/
|
|
104
118
|
export declare function framePool(): FramePool | null;
|
|
105
119
|
/**
|
|
106
|
-
* Changes the frame pool's
|
|
120
|
+
* Changes the frame pool's settings: the worker cap a runner is granted, and
|
|
121
|
+
* the timeouts, for tests that cannot wait them out.
|
|
107
122
|
*
|
|
108
123
|
* @param options - the settings to change; an omitted one keeps its value
|
|
109
124
|
* @returns every setting as it was before, to restore afterwards
|
|
110
|
-
*
|
|
125
|
+
*
|
|
126
|
+
* @remarks
|
|
127
|
+
* A new worker cap applies to the next pool. A live pool with no frame
|
|
128
|
+
* outstanding retires at once, so the next write starts one at the new cap;
|
|
129
|
+
* one with frames outstanding keeps its workers until it goes idle.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```ts
|
|
133
|
+
* // A runner granted one thread frames every output inline.
|
|
134
|
+
* configureFramePool({ workers: 1 });
|
|
135
|
+
* ```
|
|
111
136
|
*/
|
|
112
137
|
export declare function configureFramePool(options: FramePoolSettings): Required<FramePoolSettings>;
|
|
113
138
|
/** Status cell values, for the worker. @internal */
|
|
@@ -116,4 +141,20 @@ export declare const FRAME_STATUS: {
|
|
|
116
141
|
readonly DONE: 1;
|
|
117
142
|
readonly FAILED: 2;
|
|
118
143
|
};
|
|
144
|
+
/** A frame, as the pool posts it to a worker. @internal */
|
|
145
|
+
export interface FrameJob {
|
|
146
|
+
/** The slot the frame travels through. */
|
|
147
|
+
slot: number;
|
|
148
|
+
/** The logical bytes' length, from the start of the slot's input. */
|
|
149
|
+
length: number;
|
|
150
|
+
/** The requested frame codec. */
|
|
151
|
+
codec: Beast2Codec;
|
|
152
|
+
/** The slot's buffers, when the worker does not have them as they are now:
|
|
153
|
+
* the slot's first frame, and a frame larger than the slot held. */
|
|
154
|
+
buffers?: {
|
|
155
|
+
input: SharedArrayBuffer;
|
|
156
|
+
output: SharedArrayBuffer;
|
|
157
|
+
status: SharedArrayBuffer;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
119
160
|
//# sourceMappingURL=frame-pool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-pool.d.ts","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frame-pool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"frame-pool.d.ts","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frame-pool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAE,KAAK,WAAW,EAAoB,MAAM,aAAa,CAAC;AAOjE,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,oDAAoD;IACpD,KAAK,IAAI,OAAO,CAAC;IACjB;;;;;;;;OAQG;IACH,IAAI,IAAI,UAAU,CAAC;CACpB;AAED,2CAA2C;AAC3C,MAAM,WAAW,SAAS;IACxB,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,YAAY,CAAC;IAC9D;;;;;;OAMG;IACH,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED,kEAAkE;AAClE,MAAM,WAAW,iBAAiB;IAChC;;sDAEkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;qDACiD;IACjD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;4CACwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA6DD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,SAAS,GAAG,IAAI,CAO5C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAa1F;AAyMD,oDAAoD;AACpD,eAAO,MAAM,YAAY;;;;CAAqC,CAAC;AAE/D,2DAA2D;AAC3D,MAAM,WAAW,QAAQ;IACvB,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,KAAK,EAAE,WAAW,CAAC;IACnB;yEACqE;IACrE,OAAO,CAAC,EAAE;QAAE,KAAK,EAAE,iBAAiB,CAAC;QAAC,MAAM,EAAE,iBAAiB,CAAC;QAAC,MAAM,EAAE,iBAAiB,CAAA;KAAE,CAAC;CAC9F"}
|
|
@@ -2,11 +2,61 @@
|
|
|
2
2
|
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
3
|
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Beast2 v5 frame pool — deflating frames on worker threads (issue #763).
|
|
7
|
+
*
|
|
8
|
+
* v5 frames are independent (one segment per frame, each decoded standalone),
|
|
9
|
+
* so a writer can deflate them in parallel with no format change, provided it
|
|
10
|
+
* puts them on the wire in submission order. The pool is only the parallel
|
|
11
|
+
* half: {@link Beast2Writer} submits each segment's logical bytes and appends
|
|
12
|
+
* the resulting frames in order, assigning index offsets as they land.
|
|
13
|
+
*
|
|
14
|
+
* The writer's API is synchronous — {@link Beast2Writer.write} is called from
|
|
15
|
+
* inside compiled East bodies (the emit sink) — so results cannot come back as
|
|
16
|
+
* messages the main thread would have to yield to receive. A frame instead
|
|
17
|
+
* travels through a slot: three `SharedArrayBuffer`s — the logical bytes in,
|
|
18
|
+
* the frame bytes out, and a status cell the worker flips and
|
|
19
|
+
* `Atomics.notify`s — handed to one worker once and reused by every frame
|
|
20
|
+
* after, grown only for a larger segment. The main thread polls the cell to
|
|
21
|
+
* append what is done and `Atomics.wait`s on it only when it must
|
|
22
|
+
* (back-pressure, a settle, `finish`).
|
|
23
|
+
*
|
|
24
|
+
* Nothing a frame allocates waits on a worker's garbage collector. A worker
|
|
25
|
+
* allocates almost nothing on its own heap, so its collector rarely runs — V8
|
|
26
|
+
* weighs buffers' memory towards a collection only after about 64 MiB of it per
|
|
27
|
+
* isolate — and fresh buffers shared per frame were held up to that much per
|
|
28
|
+
* worker (#841). The pool holds its slots: two segments' bytes for each frame in
|
|
29
|
+
* flight, and a writer keeps at most two in flight per worker. A slot grows by
|
|
30
|
+
* doubling, so the buffers it outgrew, which wait on that GC, come to less than
|
|
31
|
+
* it holds.
|
|
32
|
+
*
|
|
33
|
+
* Node-only and optional: without `worker_threads`, `SharedArrayBuffer` or a
|
|
34
|
+
* second CPU, {@link framePool} returns `null` and the writer frames inline,
|
|
35
|
+
* which yields the same bytes. Node's modules are reached through
|
|
36
|
+
* `process.getBuiltinModule` — as `frames.ts` reaches zlib — so browser
|
|
37
|
+
* bundles never see a `node:` import.
|
|
38
|
+
*
|
|
39
|
+
* A runner granted a number of threads caps the pool at that many workers
|
|
40
|
+
* ({@link configureFramePool}): a grant of one thread frames every write
|
|
41
|
+
* inline.
|
|
42
|
+
*
|
|
43
|
+
* A worker can die without flipping a status cell — a worker-thread OOM ends
|
|
44
|
+
* its isolate before its `catch` runs — and the main thread cannot receive the
|
|
45
|
+
* worker's `exit` event while it is blocked waiting on that worker's frame. So
|
|
46
|
+
* every wait is bounded: a frame pending past the wait timeout fails, the pool
|
|
47
|
+
* is abandoned, and the process frames inline from then on. A worker's failure
|
|
48
|
+
* the main thread hears between writes — its `error` event — abandons the pool
|
|
49
|
+
* the same way, where unheard it would end the process.
|
|
50
|
+
*
|
|
51
|
+
* The pool is process-wide and outlives the write that started it, so a
|
|
52
|
+
* long-lived process — an API server, a terminal UI — would otherwise keep one
|
|
53
|
+
* idle V8 isolate per CPU for good. A pool with no frame outstanding and no
|
|
54
|
+
* activity for the idle limit terminates its workers, and the next pooled
|
|
55
|
+
* write starts a new pool. A writer abandoned mid-flight never takes its
|
|
56
|
+
* frames, so it keeps the pool alive; the idle check is `unref`'d, so process
|
|
57
|
+
* exit is unaffected either way.
|
|
58
|
+
*/
|
|
59
|
+
import { FRAME_HEADER_MAX } from "./frames.js";
|
|
10
60
|
/** Status cell values. */
|
|
11
61
|
const PENDING = 0;
|
|
12
62
|
const DONE = 1;
|
|
@@ -33,8 +83,12 @@ const FRAME_POOL_IDLE_MS = 30_000;
|
|
|
33
83
|
/** How often the live pool is checked for idleness (more often only when the
|
|
34
84
|
* idle limit is shorter). */
|
|
35
85
|
const IDLE_CHECK_INTERVAL_MS = 10_000;
|
|
36
|
-
/** The
|
|
86
|
+
/** The bytes a slot's input starts with, so a run of small segments does not
|
|
87
|
+
* grow it frame by frame. */
|
|
88
|
+
const SLOT_MIN_BYTES = 64 * 1024;
|
|
89
|
+
/** The settings in force; {@link configureFramePool} changes them. */
|
|
37
90
|
const settings = {
|
|
91
|
+
workers: FRAME_POOL_MAX_WORKERS,
|
|
38
92
|
waitTimeoutMs: FRAME_WAIT_TIMEOUT_MS,
|
|
39
93
|
idleMs: FRAME_POOL_IDLE_MS,
|
|
40
94
|
};
|
|
@@ -47,12 +101,14 @@ let idleCheck;
|
|
|
47
101
|
* The process's frame pool, created on first use — and again after an idle
|
|
48
102
|
* pool retired its workers.
|
|
49
103
|
*
|
|
50
|
-
* @returns the pool, or `null` when frames must be written inline —
|
|
51
|
-
* `worker_threads`, no `SharedArrayBuffer`, a
|
|
52
|
-
* (a pool per worker would only
|
|
53
|
-
* an earlier pool lost a worker
|
|
104
|
+
* @returns the pool, or `null` when frames must be written inline — a grant of
|
|
105
|
+
* fewer than two workers, no Node `worker_threads`, no `SharedArrayBuffer`, a
|
|
106
|
+
* single CPU, not the main thread (a pool per worker would only
|
|
107
|
+
* oversubscribe), worker start-up failed, or an earlier pool lost a worker
|
|
54
108
|
*/
|
|
55
109
|
export function framePool() {
|
|
110
|
+
if (settings.workers < 2)
|
|
111
|
+
return null;
|
|
56
112
|
if (shared === undefined) {
|
|
57
113
|
shared = createPool();
|
|
58
114
|
armIdleCheck();
|
|
@@ -60,14 +116,32 @@ export function framePool() {
|
|
|
60
116
|
return shared;
|
|
61
117
|
}
|
|
62
118
|
/**
|
|
63
|
-
* Changes the frame pool's
|
|
119
|
+
* Changes the frame pool's settings: the worker cap a runner is granted, and
|
|
120
|
+
* the timeouts, for tests that cannot wait them out.
|
|
64
121
|
*
|
|
65
122
|
* @param options - the settings to change; an omitted one keeps its value
|
|
66
123
|
* @returns every setting as it was before, to restore afterwards
|
|
67
|
-
*
|
|
124
|
+
*
|
|
125
|
+
* @remarks
|
|
126
|
+
* A new worker cap applies to the next pool. A live pool with no frame
|
|
127
|
+
* outstanding retires at once, so the next write starts one at the new cap;
|
|
128
|
+
* one with frames outstanding keeps its workers until it goes idle.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* // A runner granted one thread frames every output inline.
|
|
133
|
+
* configureFramePool({ workers: 1 });
|
|
134
|
+
* ```
|
|
68
135
|
*/
|
|
69
136
|
export function configureFramePool(options) {
|
|
70
137
|
const previous = { ...settings };
|
|
138
|
+
if (options.workers !== undefined && options.workers !== settings.workers) {
|
|
139
|
+
settings.workers = options.workers;
|
|
140
|
+
if (shared instanceof WorkerFramePool && shared.outstanding === 0) {
|
|
141
|
+
void shared.terminateWorkers();
|
|
142
|
+
shared = undefined;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
71
145
|
if (options.waitTimeoutMs !== undefined)
|
|
72
146
|
settings.waitTimeoutMs = options.waitTimeoutMs;
|
|
73
147
|
if (options.idleMs !== undefined)
|
|
@@ -120,45 +194,69 @@ class WorkerFramePool {
|
|
|
120
194
|
/** When a frame was last submitted or taken, or the pool started. */
|
|
121
195
|
lastActivity = Date.now();
|
|
122
196
|
threads;
|
|
197
|
+
/** Each worker's slots with no frame in them. */
|
|
198
|
+
free;
|
|
199
|
+
slots = 0;
|
|
123
200
|
next = 0;
|
|
124
201
|
constructor(threads) {
|
|
125
202
|
this.threads = threads;
|
|
126
203
|
this.workers = threads.length;
|
|
204
|
+
this.free = threads.map(() => []);
|
|
127
205
|
}
|
|
128
206
|
submit(logical, codec) {
|
|
129
|
-
const
|
|
130
|
-
new Uint8Array(input).set(logical);
|
|
131
|
-
const output = new SharedArrayBuffer(logical.length + FRAME_HEADER_MAX);
|
|
132
|
-
const status = new Int32Array(new SharedArrayBuffer(8));
|
|
133
|
-
this.threads[this.next].postMessage({ input, length: logical.length, output, status: status.buffer, codec });
|
|
207
|
+
const worker = this.next;
|
|
134
208
|
this.next = (this.next + 1) % this.threads.length;
|
|
209
|
+
// A worker has a slot for each frame it holds, so several writers sharing
|
|
210
|
+
// the pool never wait on one another's slots.
|
|
211
|
+
const slot = this.free[worker].pop() ?? {
|
|
212
|
+
id: this.slots++,
|
|
213
|
+
input: new SharedArrayBuffer(SLOT_MIN_BYTES),
|
|
214
|
+
output: new SharedArrayBuffer(SLOT_MIN_BYTES + FRAME_HEADER_MAX),
|
|
215
|
+
status: new Int32Array(new SharedArrayBuffer(8)),
|
|
216
|
+
sent: false,
|
|
217
|
+
};
|
|
218
|
+
if (slot.input.byteLength < logical.length) {
|
|
219
|
+
const bytes = 2 ** Math.ceil(Math.log2(logical.length));
|
|
220
|
+
slot.input = new SharedArrayBuffer(bytes);
|
|
221
|
+
slot.output = new SharedArrayBuffer(bytes + FRAME_HEADER_MAX);
|
|
222
|
+
slot.sent = false;
|
|
223
|
+
}
|
|
224
|
+
new Uint8Array(slot.input).set(logical);
|
|
225
|
+
Atomics.store(slot.status, 0, PENDING);
|
|
226
|
+
const job = { slot: slot.id, length: logical.length, codec };
|
|
227
|
+
if (!slot.sent) {
|
|
228
|
+
job.buffers = { input: slot.input, output: slot.output, status: slot.status.buffer };
|
|
229
|
+
slot.sent = true;
|
|
230
|
+
}
|
|
231
|
+
this.threads[worker].postMessage(job);
|
|
135
232
|
this.outstanding++;
|
|
136
233
|
this.lastActivity = Date.now();
|
|
137
234
|
let taken = false;
|
|
138
235
|
return {
|
|
139
|
-
|
|
140
|
-
ready: () => Atomics.load(status, 0) !== PENDING,
|
|
236
|
+
ready: () => Atomics.load(slot.status, 0) !== PENDING,
|
|
141
237
|
take: () => {
|
|
142
238
|
try {
|
|
143
239
|
const deadline = Date.now() + settings.waitTimeoutMs;
|
|
144
|
-
while (Atomics.load(status, 0) === PENDING) {
|
|
240
|
+
while (Atomics.load(slot.status, 0) === PENDING) {
|
|
145
241
|
const remaining = deadline - Date.now();
|
|
146
242
|
if (this.lost || remaining <= 0) {
|
|
147
243
|
abandonPool(this);
|
|
148
244
|
throw new Error("beast2 v5: a frame worker stopped responding — its thread was lost");
|
|
149
245
|
}
|
|
150
|
-
Atomics.wait(status, 0, PENDING, Math.min(FRAME_WAIT_SLICE_MS, remaining));
|
|
246
|
+
Atomics.wait(slot.status, 0, PENDING, Math.min(FRAME_WAIT_SLICE_MS, remaining));
|
|
151
247
|
}
|
|
152
|
-
if (Atomics.load(status, 0) === FAILED) {
|
|
248
|
+
if (Atomics.load(slot.status, 0) === FAILED) {
|
|
153
249
|
throw new Error("beast2 v5: a frame worker failed to build a frame");
|
|
154
250
|
}
|
|
155
|
-
return new Uint8Array(output, 0, Atomics.load(status, 1)).slice();
|
|
251
|
+
return new Uint8Array(slot.output, 0, Atomics.load(slot.status, 1)).slice();
|
|
156
252
|
}
|
|
157
253
|
finally {
|
|
158
|
-
// Taken once, however it ended: a failed frame is not outstanding
|
|
254
|
+
// Taken once, however it ended: a failed frame is not outstanding,
|
|
255
|
+
// and its slot is free.
|
|
159
256
|
if (!taken) {
|
|
160
257
|
taken = true;
|
|
161
258
|
this.outstanding--;
|
|
259
|
+
this.free[worker].push(slot);
|
|
162
260
|
}
|
|
163
261
|
this.lastActivity = Date.now();
|
|
164
262
|
}
|
|
@@ -181,7 +279,7 @@ function createPool() {
|
|
|
181
279
|
const fs = getBuiltin("node:fs");
|
|
182
280
|
if (!threads || !os || !fs || !threads.isMainThread)
|
|
183
281
|
return null;
|
|
184
|
-
const cpus = Math.min(FRAME_POOL_MAX_WORKERS, os.availableParallelism?.() ?? os.cpus().length);
|
|
282
|
+
const cpus = Math.min(settings.workers, FRAME_POOL_MAX_WORKERS, os.availableParallelism?.() ?? os.cpus().length);
|
|
185
283
|
if (cpus < 2)
|
|
186
284
|
return null;
|
|
187
285
|
// Bundled into a single file (or loaded as CommonJS), this module has no
|
|
@@ -202,14 +300,26 @@ function createPool() {
|
|
|
202
300
|
// returned once every worker has proven it runs.
|
|
203
301
|
const ready = new Int32Array(new SharedArrayBuffer(4 * cpus));
|
|
204
302
|
const workers = [];
|
|
303
|
+
let pool;
|
|
205
304
|
const abandon = () => {
|
|
206
305
|
for (const worker of workers)
|
|
207
306
|
void worker.terminate();
|
|
208
307
|
return null;
|
|
209
308
|
};
|
|
309
|
+
// A worker that fails — its script does not load, or it throws — says so
|
|
310
|
+
// only through an `error` event, and one nobody hears ends the process.
|
|
311
|
+
const failed = () => {
|
|
312
|
+
if (pool === undefined)
|
|
313
|
+
abandon();
|
|
314
|
+
else if (!pool.lost)
|
|
315
|
+
abandonPool(pool);
|
|
316
|
+
};
|
|
210
317
|
try {
|
|
211
318
|
for (let i = 0; i < cpus; i++) {
|
|
212
|
-
|
|
319
|
+
// A worker loads one module and needs none of the process's options,
|
|
320
|
+
// which it could refuse: `--input-type` stops it loading a file.
|
|
321
|
+
const worker = new threads.Worker(script, { workerData: { ready: ready.buffer, index: i }, execArgv: [] });
|
|
322
|
+
worker.on("error", failed);
|
|
213
323
|
// Idle workers must not keep a finished process alive; a writer that
|
|
214
324
|
// is waiting on one is blocked on the main thread anyway.
|
|
215
325
|
worker.unref();
|
|
@@ -228,7 +338,8 @@ function createPool() {
|
|
|
228
338
|
Atomics.wait(ready, i, 0, remaining);
|
|
229
339
|
}
|
|
230
340
|
}
|
|
231
|
-
|
|
341
|
+
pool = new WorkerFramePool(workers);
|
|
342
|
+
return pool;
|
|
232
343
|
}
|
|
233
344
|
/** Status cell values, for the worker. @internal */
|
|
234
345
|
export const FRAME_STATUS = { PENDING, DONE, FAILED };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame-pool.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frame-pool.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"frame-pool.js","sourceRoot":"","sources":["../../../../../src/serialization/beast2/v5/frame-pool.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,EAAoB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjE,0BAA0B;AAC1B,MAAM,OAAO,GAAG,CAAC,CAAC;AAClB,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,MAAM,GAAG,CAAC,CAAC;AAmEjB;+EAC+E;AAC/E,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;kEAGkE;AAClE,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAElC;;kDAEkD;AAClD,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAErC;6BAC6B;AAC7B,MAAM,mBAAmB,GAAG,KAAK,CAAC;AAElC;;uEAEuE;AACvE,MAAM,kBAAkB,GAAG,MA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