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

PythonRespSerializer: better chunking #3076

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

VadimPushtaev
Copy link

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Previous implementation made no difference between memoryviews, that must be sent separately to avoid copying, and just reaching buffer_cutoff. That resulted in some single values being sent separately for no reason, so a chunk could be just a single encoded integer, even though the buffer_cutoff is pretty large.

@VadimPushtaev
Copy link
Author

I randomly noticed that lists like [1, 2, ..., 100] are separated to [1, ..., 50] + [51] + [52, ..., 100] instead of just [1, ..., 50] + [51, ..., 10]. This is a fix for that.

@VadimPushtaev VadimPushtaev marked this pull request as draft December 16, 2023 22:50
asyncio connection is pretty much the copy of normal redis connection,
so let's port hiredis support and also start using PythonRespSerializer.
We lack detailed tests for PythonRespSerializer, so let's add them.
The current behaviour is weird and will be changed by the following
commit, but the tests are still needed to explicitly show the change.
Previous implementation made no difference between memoryviews, that must
be sent separately to avoid copying, and just reaching buffer_cutoff.
That resulted in some single values being sent separately for no reason,
so a chunk could be just a single encoded integer, even though the
buffer_cutoff is pretty large.
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.

None yet

1 participant