Skip to content

v3.3.2 - #170

Merged
Archmonger merged 8 commits into
reactive-python:mainfrom
Archmonger:3.3.2
Aug 14, 2023
Merged

v3.3.2#170
Archmonger merged 8 commits into
reactive-python:mainfrom
Archmonger:3.3.2

Conversation

@Archmonger

@Archmonger Archmonger commented Aug 9, 2023 •

Copy link
Copy Markdown
Contributor

By submitting this pull request you agree that all contributions to this project are made under the MIT license.

Description

Added

  • ReactPy Websocket will now decode messages via orjson resulting in an ~6% overall performance boost.
  • Built-in asyncio event loops are now patched via nest_asyncio, resulting in an ~10% overall performance boost on Windows. This has no performance impact if you are running your webserver with uvloop.

Fixed

  • Fix bug where REACTPY_WEBSOCKET_URL always generates a warning if unset.
  • Fixed bug where assert f is self._write_fut would be raised within uvicorn on Windows when REACTPY_BACKHAUL_THREAD = True.
  • Fixed bug where rendering behavior would be jittery with daphne on Windows when REACTPY_BACKHAUL_THREAD = True.

@Archmonger

Archmonger commented Aug 13, 2023 •

Copy link
Copy Markdown
Contributor Author

@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.

@Archmonger
Archmonger marked this pull request as ready for review August 13, 2023 23:56
@Archmonger
Archmonger requested a review from a team as a code owner August 13, 2023 23:56
@Archmonger
Archmonger merged commit b058b9e into reactive-python:main Aug 14, 2023
@Archmonger
Archmonger deleted the 3.3.2 branch August 14, 2023 00:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant