How to iterate a python async iterator in a web worker? Is there a large overhead? #4642
Unanswered
CNSeniorious000
asked this question in
Q&A
Replies: 1 comment 1 reply
-
I am not sure how much overhead there is for transferring main thread <--> web worker. Maybe @alexmojaki has some experience with this? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi team, let me introduce my use case first:
I have a js async iterator which yields about 20-500 times per seconds, I need to iterate it in python, and it (the python async iterator) will call a javascript callback each iteration. Currently I am using
pyodide
in the main thread, which always blocks a few seconds when initiating.Now I am considering running the python code in a web worker, but I am not sure whether the overhead frequently transfer data between the worker and the mainthread (40-1000 times per second) is expensive. Do you have any idea?
And is that hard to implement? I am checking the
pyodide/synclink
library, but I failed to find anything related to iterating between the worker and the main thread. Is that even possible? And is that expensive?Beta Was this translation helpful? Give feedback.
All reactions