Closed Archmonger closed 1 year ago
@rmorshea I'm going to merge this as a temporary hotfix, but I'm honestly kind of shocked using nest_asyncio
fixes both assert f is self._write_fut
exceptions on Uvicorn and also jittery rendering behavior Daphne.
My best guess is the way that the Windows ProactorEventLoop
enqueues tasks is inherently not thread safe, and maybe nest_asyncio
serializes this task queue? I'm even more shocked that this results in a overall performance improvement.
There's still one open bug: Some Windows environments have degraded performance when running via backhaul thread. I've actually experienced this once in the past, but I've been unable to replicate it.
Will need to do a deeper dive into this in the future. Given that the issue existed for me before but is now gone (same Python version), this is likely somehow related to CPython optimizations.
By submitting this pull request you agree that all contributions to this project are made under the MIT license.
Description
Added
orjson
resulting in an ~6% overall performance boost.asyncio
event loops are now patched vianest_asyncio
, resulting in an ~10% overall performance boost on Windows. This has no performance impact if you are running your webserver withuvloop
.Fixed
REACTPY_WEBSOCKET_URL
always generates a warning if unset.assert f is self._write_fut
would be raised withinuvicorn
on Windows whenREACTPY_BACKHAUL_THREAD = True
.daphne
on Windows whenREACTPY_BACKHAUL_THREAD = True
.