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

Do manual line buffering in Python #149

Merged
merged 1 commit into from
Jan 26, 2018

Conversation

simonlindholm
Copy link
Contributor

This reduces the Python overhead by a factor ~5-10 (!). Previously when our program ran for like 10ms Python accounted for 30ms and made it difficult not to time out; now that becomes ~3-6ms.

Conflicts somewhat with #147, and makes #148 rather less important (though it's probably still a good idea).

@simonlindholm
Copy link
Contributor Author

Oh, and I've tested this in both docker and nodocker on Linux, not on other OSes though (maybe Windows is weird with certain types of sockets).

@simonlindholm
Copy link
Contributor Author

simonlindholm commented Jan 23, 2018

(Note that recv_socket.makefile('rwb', 1) only creates a line-buffered file object in Python 2; in Python 3 it changed semantics to have a buffer of size 1 instead. Which I guess you could technically still refer to as line buffered, but performance is abysmal.)

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.

2 participants