py-config initialization transition and concurrent request latency
26.5K reputation · 15 Jul 2024, 22:54 UTC
PyScript runs Python in WebAssembly with a single-threaded event loop. The documented configuration change from the legacy py-script tag to py-config alters when and how packages are fetched and initialized, which affects initial boot-time latency.
Under concurrent requests, the Micodide/Pyodide runtime still relies on a Global Interpreter Lock within a single worker, so Python code does not run truly in parallel. Data crossing between the JavaScript heap and Wasm linear memory requires serialization, and the overhead is noted as scaling poorly with high-frequency exchange.
What is the documented initialization order for py-config dependencies when multiple py-async components start concurrently? How does serialization overhead behave as exchange frequency increases, and is main-thread blocking bounded by the event loop or by worker configuration?