🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Improve the performance of `_run_checks` and `_run_async_checks` (#1454)
Currently we have two functions with logic on how to run endpoint checks:
django-modern-rest/dmr/endpoint.py
Lines 417 to 425 in 405ba9b
and then we check inside each call if this call was even needed:
django-modern-rest/dmr/endpoint.py
Lines 427 to 432 in 405ba9b
We should check if the call is needed before the call itself. And only call parts that are actually required.
This is especially important for the async code:
django-modern-rest/dmr/endpoint.py
Lines 460 to 471 in 405ba9b
Where we are awaiting 4 indeprendent coroutines.
We should not, if possible.
#good_first_issue #help_wanted #performance #opensource_september #django_modern_rest
sent via relator
📝 Improve the performance of `_run_checks` and `_run_async_checks` (#1454)
Currently we have two functions with logic on how to run endpoint checks:
django-modern-rest/dmr/endpoint.py
Lines 417 to 425 in 405ba9b
and then we check inside each call if this call was even needed:
django-modern-rest/dmr/endpoint.py
Lines 427 to 432 in 405ba9b
CALL is not a cheap operation in Python, so I propose a different design.We should check if the call is needed before the call itself. And only call parts that are actually required.
This is especially important for the async code:
django-modern-rest/dmr/endpoint.py
Lines 460 to 471 in 405ba9b
Where we are awaiting 4 indeprendent coroutines.
We should not, if possible.
#good_first_issue #help_wanted #performance #opensource_september #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Cache the negotiation parts (#1455)
Most of the headers are simple and repeatable. Most users will just send
Prefer not to have any API changes here.
#good_first_issue #help_wanted #performance #opensource_september #django_modern_rest
sent via relator
📝 Cache the negotiation parts (#1455)
Most of the headers are simple and repeatable. Most users will just send
Content-Type: application/json and Accept: application/json like 99% of the time. So, there's no need to run the negotiation process the second time. We already know the final result. So, go through the https://github.com/wemake-services/django-modern-rest/blob/master/dmr/negotiation.py and find places where we can cache header_value -> parser_class or header_value -> renderer_class computations.Prefer not to have any API changes here.
#good_first_issue #help_wanted #performance #opensource_september #django_modern_rest
sent via relator
🚀 New issue to wemake-services/django-modern-rest by @sobolevn
📝 Pre-compute headers and cookies for `@modify` (#1456)
This is a very important hot-path optimization: currently we build headers and cookies for each response:
django-modern-rest/dmr/validation/response.py
Lines 106 to 110 in 405ba9b
But, as you can see, there's nothing special about each of these calls, they are all the same for the same endpoint. That's why I propose to make this call only once when the endpoint is built in the import time. It would be faster.
#good_first_issue #help_wanted #performance #opensource_september #django_modern_rest
sent via relator
📝 Pre-compute headers and cookies for `@modify` (#1456)
This is a very important hot-path optimization: currently we build headers and cookies for each response:
django-modern-rest/dmr/validation/response.py
Lines 106 to 110 in 405ba9b
But, as you can see, there's nothing special about each of these calls, they are all the same for the same endpoint. That's why I propose to make this call only once when the endpoint is built in the import time. It would be faster.
#good_first_issue #help_wanted #performance #opensource_september #django_modern_rest
sent via relator