feat(core): configurable WASM worker thread count via EndpointFactory setup()#161
Draft
imaTik0 wants to merge 1 commit intofeat/refactor-driver-contextfrom
Draft
feat(core): configurable WASM worker thread count via EndpointFactory setup()#161imaTik0 wants to merge 1 commit intofeat/refactor-driver-contextfrom
imaTik0 wants to merge 1 commit intofeat/refactor-driver-contextfrom
Conversation
….setup()
AsyncEngine (C++):
- Add EM_JS readWorkerCountFromJs() that reads window.__privmxWorkerCount
- AsyncEngine() constructor reads the global and uses it as the thread-pool
size (defaults to 4 when absent; enforces minimum of 2)
EndpointFactory (TypeScript):
- setup() now accepts string | EndpointSetupOptions (backwards-compatible;
a plain string assetsBasePath is still accepted)
- New EndpointSetupOptions interface: { assetsBasePath?, workerCount? }
- When workerCount is provided, sets window.__privmxWorkerCount before
calling endpointWasmModule() so the C++ constructor reads it during
WASM initialisation on the worker thread
Tests (E2E):
- measureSendMessages() helper: reload page, call setup({ workerCount }),
send N messages concurrently, return elapsed ms
- "Worker count / EndpointFactory.setup() initialises WASM with the
requested worker count": runs at 2/4/8/16 workers, logs timings
- measureSignData() helper: same pattern using 200 concurrent signData
calls (CPU-bound secp256k1, no network)
- "Worker count scales CPU-bound crypto throughput": hard-asserts that
4w < 2w and 8w < 4w to verify the parameter actually controls parallelism
- setup({ assetsBasePath }) object-form test: verifies connect + key
derivation work end-to-end when using the new options object
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AsyncEngine (C++):
EndpointFactory (TypeScript):
Tests (E2E):