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

[READY] Remove Python version check #2585

Merged
merged 1 commit into from Mar 26, 2017
Merged

Conversation

micbou
Copy link
Collaborator

@micbou micbou commented Mar 25, 2017

Even with the -S option (see PR #2502), starting the Python interpreter to check its version can be slow. For instance, on my machine (in PowerShell):

> Measure-Command -Expression {python -S -c "pass"}
...
TotalMilliseconds : 25,4387

It's also not particularly useful because, in the typical case, the Python used to start ycmd will be the one from PYTHON_USED_DURING_BUILDING which is necessarily a supported version. In the cases where the g:ycm_server_python_interpreter option is specified or a Python is found in the PATH, it's up to the user to provide a supported version. If they don't, the ycmd server will probably fail to start and the following error will be displayed to them:

The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code 1. Use the ':YcmToggleLogs' command to check the logs.

They can then look at the logs to understand what went wrong.
Finally, the last case is when the Python is the one used by YCM itself. In that case, if the Python version is not supported, it will fail before doing the check so it doesn't matter.

As always, here are the improvements on startup time:

Platform First run (ms) Subsequent runs (ms)
Before After Before After
Ubuntu 16.04 64-bit 147 134 74 65
macOS 10.12 189 165 127 107
Windows 10 64-bit 242 200 147 115

Results obtained by running the prof.py script from this branch on Python 3.6.


This change is Reviewable

@Valloric
Copy link
Member

:lgtm: with minor comment

Thanks for the PR!


Review status: 0 of 2 files reviewed at latest revision, 1 unresolved discussion.


python/ycm/paths.py, line 53 at r1 (raw file):

@Memoize
def PathToPythonInterpreter():

I'd prefer a comment here explaining why we don't explicitly check the version of python we find. A simple "Calling the python binary to check its version significantly impacts startup time" will suffice.


Comments from Reviewable

Starting the Python interpreter to check its version is slow.
@micbou
Copy link
Collaborator Author

micbou commented Mar 25, 2017

Reviewed 1 of 1 files at r2.
Review status: 1 of 2 files reviewed at latest revision, 1 unresolved discussion.


python/ycm/paths.py, line 53 at r1 (raw file):

Previously, Valloric (Val Markovic) wrote…

I'd prefer a comment here explaining why we don't explicitly check the version of python we find. A simple "Calling the python binary to check its version significantly impacts startup time" will suffice.

Done.


Comments from Reviewable

@codecov-io
Copy link

codecov-io commented Mar 25, 2017

Codecov Report

Merging #2585 into master will decrease coverage by 0.04%.
The diff coverage is 80%.

@@            Coverage Diff             @@
##           master    #2585      +/-   ##
==========================================
- Coverage   86.16%   86.11%   -0.05%     
==========================================
  Files          19       19              
  Lines        1951     1945       -6     
==========================================
- Hits         1681     1675       -6     
  Misses        270      270

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 53e4de0...f84796b. Read the comment docs.

@vheon
Copy link
Contributor

vheon commented Mar 25, 2017

:lgtm:


Reviewed 1 of 2 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Comments from Reviewable

@Valloric
Copy link
Member

@homu r+

@homu
Copy link
Contributor

homu commented Mar 26, 2017

📌 Commit f84796b has been approved by Valloric

@homu
Copy link
Contributor

homu commented Mar 26, 2017

⚡ Test exempted - status

@homu homu merged commit f84796b into ycm-core:master Mar 26, 2017
homu added a commit that referenced this pull request Mar 26, 2017
[READY] Remove Python version check

Even with the `-S` option (see PR #2502), starting the Python interpreter to check its version can be slow. For instance, on my machine (in PowerShell):
```ps
> Measure-Command -Expression {python -S -c "pass"}
...
TotalMilliseconds : 25,4387
```
It's also not particularly useful because, in the typical case, the Python used to start ycmd will be the one from `PYTHON_USED_DURING_BUILDING` which is necessarily a supported version. In the cases where the `g:ycm_server_python_interpreter` option is specified or a Python is found in the PATH, it's up to the user to provide a supported version. If they don't, the ycmd server will probably fail to start and the following error will be displayed to them:
```
The ycmd server SHUT DOWN (restart with ':YcmRestartServer'). Unexpected exit code 1. Use the ':YcmToggleLogs' command to check the logs.
```
They can then look at the logs to understand what went wrong.
Finally, the last case is when the Python is the one used by YCM itself. In that case, if the Python version is not supported, it will fail before doing the check so it doesn't matter.

As always, here are the improvements on startup time:
<table>
  <tr>
    <th rowspan="2">Platform</th>
    <th colspan="2">First run (ms)</th>
    <th colspan="2">Subsequent runs (ms)</th>
  </tr>
  <tr>
    <td>Before</td>
    <td>After</td>
    <td>Before</td>
    <td>After</td>
  </tr>
  <tr>
    <td>Ubuntu 16.04 64-bit</td>
    <td>147</td>
    <td>134</td>
    <td>74</td>
    <td>65</td>
  </tr>
  <tr>
    <td>macOS 10.12</td>
    <td>189</td>
    <td>165</td>
    <td>127</td>
    <td>107</td>
  </tr>
  <tr>
    <td>Windows 10 64-bit</td>
    <td>242</td>
    <td>200</td>
    <td>147</td>
    <td>115</td>
  </tr>
</table>

*Results obtained by running the `prof.py` script from [this branch](https://github.com/micbou/YouCompleteMe/tree/profiling-startup) on Python 3.6.*

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2585)
<!-- Reviewable:end -->
@micbou micbou deleted the remove-python-check branch March 26, 2017 17:49
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

5 participants