Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route logging is extremely slow #191

Open
ZeroIntensity opened this issue Jun 25, 2024 · 1 comment
Open

Route logging is extremely slow #191

ZeroIntensity opened this issue Jun 25, 2024 · 1 comment
Assignees
Labels
c api This has to do with the C API (_view) complex This should only be looked at by someone who knows what they're doing hot This is high priority improvement Improvement to an existing feature
Milestone

Comments

@ZeroIntensity
Copy link
Owner

Description:

view.py's route logging system through route_log in the C API is extremely slow. Basically, with the new PyAwaitable vendor on the reactpy branch, view.py is slower than pretty much all other web frameworks with route logging enabled.

With route logging disabled, it becomes several times faster, and outperforms every Python ASGI framework (that I've tried, at least). I tested FastAPI, BlackSheep, and Emmett, and view.py beat all of them with it's route logger disabled.

So, what's the fix? Well, we could just leave route logging out, but that's going to remove some debugging ability for the user, so there's three main options here:

  • Only enable route logging during development mode.
  • Optimize the route logging implementation (either write it in C, or compile it with Cython or something)
  • Perform route logging in it's own thread, using only C file streams. This would remove interop with Python, so we'd have to add some settings.
@ZeroIntensity ZeroIntensity added improvement Improvement to an existing feature complex This should only be looked at by someone who knows what they're doing c api This has to do with the C API (_view) labels Jun 25, 2024
@ZeroIntensity ZeroIntensity added this to the Beta Release milestone Jun 25, 2024
@ZeroIntensity
Copy link
Owner Author

ZeroIntensity commented Jun 25, 2024

I'll probably have to put together a library for asynchronous and fast logging, with a C API detached from the GIL.

@ZeroIntensity ZeroIntensity added the hot This is high priority label Jun 26, 2024
@ZeroIntensity ZeroIntensity self-assigned this Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c api This has to do with the C API (_view) complex This should only be looked at by someone who knows what they're doing hot This is high priority improvement Improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant