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

Use actual bytesarray/memoryview instead of bytes concatenation #113

Open
arcivanov opened this issue Dec 9, 2017 · 0 comments
Open

Use actual bytesarray/memoryview instead of bytes concatenation #113

arcivanov opened this issue Dec 9, 2017 · 0 comments

Comments

@arcivanov
Copy link
Member

Bytes concatenation such as this is extremely wasteful and is never a good idea.

https://github.com/fluent/fluent-logger-python/blob/master/fluent/sender.py#L137

        # buffering
        if self.pendings:
            self.pendings += bytes_
            bytes_ = self.pendings

Python has mutable buffers that should be used to ensure that the objects aren't created needlessly putting pressure on GC and wasting CPU with double-copy concatenation.

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

No branches or pull requests

1 participant