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

Rewrite frame_buffer to use bytearray() #474

Open
Lukasa opened this issue Mar 7, 2017 · 2 comments
Open

Rewrite frame_buffer to use bytearray() #474

Lukasa opened this issue Mar 7, 2017 · 2 comments

Comments

@Lukasa
Copy link
Member

Lukasa commented Mar 7, 2017

Good artists copy, great artists steal. One of @njsmith's great decisions with h11 was to write his buffer in terms of bytearray. This has some major efficiency gains on Python 3.4.

An easy win for us would be to rewrite the buffering internals of our frame buffer using h11's, while removing the things that h11's buffer implements that we don't need (in particular, any line-oriented constructs). Before we do it, we should write a benchmark of the buffering performance under reasonable HTTP/2 conditions to see what kind of improvements we see.

While I'm here: @fijal, the comments in h11's framebuffer say:

# Note that starting in Python 3.4, deleting the initial n bytes from a
# bytearray is amortized O(n), thanks to some excellent work by Antoine
# Martin:
#
#     https://bugs.python.org/issue19087

...

# make sure PyPy also has the optimization

Does it?

@njsmith
Copy link
Member

njsmith commented Mar 7, 2017 via email

@Lukasa
Copy link
Member Author

Lukasa commented Mar 7, 2017

Yup, I'd be happy to depend on such a module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants