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 system default buffering on Python 2 #1149

Merged
merged 1 commit into from Jun 21, 2018

Conversation

micbou
Copy link
Contributor

@micbou micbou commented Jun 20, 2018

By default, streams are unbuffered on Python 2 (bufsize = 0) while system default buffering is used on Python 3 (bufsize = -1). Using system default buffering as well on Python 2 improves performance.

Here are some measurements obtained with this script when completing the os, numpy, and cv2 (opencv-python) modules on Python 2 and Ubuntu 18.04 64-bit:

Environment Python 2.7 Python 3.6
bufsize 0 -1 0 -1
os 0.145s 0.102s 0.162s 0.104s
numpy 0.217s 0.185s 0.224s 0.192s
cv2 0.921s 0.664s 0.987s 0.676s

This change is Reviewable

@codecov-io
Copy link

Codecov Report

Merging #1149 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1149      +/-   ##
==========================================
- Coverage   92.78%   92.72%   -0.06%     
==========================================
  Files          57       57              
  Lines        6902     6902              
==========================================
- Hits         6404     6400       -4     
- Misses        498      502       +4
Impacted Files Coverage Δ
jedi/evaluate/compiled/subprocess/__init__.py 75% <ø> (-2.05%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e96ebbe...a9c3294. Read the comment docs.

@davidhalter
Copy link
Owner

Great, thanks! Good catch.

@davidhalter davidhalter merged commit f9e90e8 into davidhalter:master Jun 21, 2018
@micbou micbou deleted the bufsize branch June 21, 2018 19:56
zzbot added a commit to ycm-core/ycmd that referenced this pull request Jun 23, 2018
[READY] Include Jedi performance improvements

This includes PRs davidhalter/jedi#1149, davidhalter/jedi#1150, davidhalter/jedi#1151, and davidhalter/jedi#1152 which significantly improve performance especially on Windows and Python 2.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/1056)
<!-- Reviewable:end -->
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

3 participants