Repository navigation
[labs/ssr] Experiment with node:worker_threads Worker - #5153
kyubisation wants to merge 4 commits into
Conversation
|
940cc66 to
ec6e8a1
Compare
ec6e8a1 to
f4436b7
Compare
|
@kyubisation awesome stuff! I think that we can make the shared cache work by making an interface for a sync or async cache: interface LocalTemplateCache {
kind: 'local';
get(strings: TemplateStringsArray): Array<Op>;
set(strings: TemplateStringsArray, ops: Array<Op>): void;
}
interface RemoteTemplateCache {
kind: 'remote';
get(strings: TemplateStringsArray): Promise<Array<Op>>;
set(strings: TemplateStringsArray, ops: Array<Op>): Promise<void>;
}
type TemplateCache = LocalTemplateCache | RemoteTemplateCache;Then we have to thread the sync-or-async nature through A tricky part is |
This is a draft pull request to experiment with
node:worker_threadsWorker.Findings:
Depending on use case it might make sense to use a single render Worker instance or multiple. Might require additional performance testing.
rawproperty of aTemplateStringsArray, as just the array is transferred.registerRenderRequestHandleror implement your own logic for handling messages). Seerender-worker_test.ts.Questions:
node:worker_threadsWorkers?