-
-
Notifications
You must be signed in to change notification settings - Fork 471
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
Improve Performance for Async Pagination #1414
Conversation
aget_list_or_404 seems aded only in 5.x django maybe it just worth adding some await [obj async for obj in queryset[offset: offset + self.page_size]] throwing 404 if empty here also does not make sense actually |
hi @tim-hub |
This makes sense, I have updated it. |
I have run it again, It basically kept the same pattern, that new async pagination( and sync pagination) performance better than origin async pagination without the changes. not surprisingly |
latest commit to fix the failing test |
i think if-statement should be other way around if isinstance(queryset, list): to
|
I see, make sense |
django ninja is a good framework, when I work on the project, I found the pagination on async view is much lower than sync view for performance wise, like row 1 and row 3, so I have made some update for the pagination class.
In another word, if use the origin pagination on async view, it is actually does not bring any befenits for performance but slow it down. This PR is to resolve this.