You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looking trough the issue i see that there are a bunch of gyp, electron and loop / freezes and high cpu issues floating around.
What i was looking for was a solution that did not only works in nodejs but also works for other env. too. like Deno, Bun.js and heck even web workers.
And there where basically nothing out there what i could find. everything is so NodeJS specific or poorly implemented that uses eg child processes or worker_threads, so transferring data to other threads where very limited.
transfer the function stringifyed code to that worker
and once you call the get fn, a postMessage is sent to the worker with all the arguments and the current thread will freeze using Atomic.wait()... The entire event loop is halted.
only the worker can unfreeze it now. now the worker instead dose all the work async.
and to achieve transferring the content back to the thread without using onmessage or even using worker.receiveMessageOnPort(port) which isn't so cross env. friendly btw... is achived using only SharedArrayBuffer + Atomic dance.
The text was updated successfully, but these errors were encountered:
Looking trough the issue i see that there are a bunch of gyp, electron and loop / freezes and high cpu issues floating around.
What i was looking for was a solution that did not only works in nodejs but also works for other env. too. like Deno, Bun.js and heck even web workers.
And there where basically nothing out there what i could find. everything is so NodeJS specific or poorly implemented that uses eg child processes or worker_threads, so transferring data to other threads where very limited.
So now i introduce to you: await-sync
Here it's in its simplest form:
Using this solution will:
get
fn, a postMessage is sent to the worker with all the arguments and the current thread will freeze usingAtomic.wait()
... The entire event loop is halted.onmessage
or even using worker.receiveMessageOnPort(port) which isn't so cross env. friendly btw... is achived using only SharedArrayBuffer + Atomic dance.The text was updated successfully, but these errors were encountered: