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

Skip coercing to bytes in merge_frames #3960

Merged
merged 1 commit into from
Jul 14, 2020

Commits on Jul 14, 2020

  1. Skip coercing to bytes in merge_frames

    As the frames we receive are typically mutable, non-`bytes` objects like
    `bytearray`s or NumPy `ndarray`s, coercing to `bytes` at this stage
    triggers a copy of all frames. As we are going to toss those copied
    versions anyways when joining them into a larger `bytes` object, this
    ends up being wasteful with memory. Fortunately `bytes.join(...)`
    accepts any and all `bytes`-like objects. So instead just pass them all
    through as-is to `bytes.join(...)`, which is free and doesn't require a
    copy.  Should cutdown on the memory usage in this part of the code.
    jakirkham committed Jul 14, 2020
    Configuration menu
    Copy the full SHA
    a3671e4 View commit details
    Browse the repository at this point in the history