-
Notifications
You must be signed in to change notification settings - Fork 768
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] Cache include paths #919
Conversation
Review status: 0 of 5 files reviewed at latest revision, all discussions resolved. ycmd/completers/cpp/flags.py, line 678 at r2 (raw file):
@puremourning mentioned somehow making the use of the include flags at the top of the file. ycmd/completers/cpp/flags.py, line 682 at r2 (raw file):
@puremourning This shouldn't use ycmd/completers/cpp/include_cache.py, line 115 at r2 (raw file):
@puremourning We could probably update the whole directory entry instead of just deleting it, but... We still need to do most of the work we are already doing, yet the code would get less readable. Comments from Reviewable |
Review status: 0 of 5 files reviewed at latest revision, 3 unresolved discussions. ycmd/completers/cpp/flags.py, line 678 at r2 (raw file): Previously, bstaletic (Boris Staletic) wrote…
The reason we're not going "full-hog" and caching everything right now is that the lines above make it easy to test what works the best. @puremourning Once you say what works best, we could even drop tupples and maybe unconditionally use cache. ycmd/completers/cpp/include_cache.py, line 115 at r2 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Actually, if we change if mtime > cache_entry[ 0 ]:
_AddToCache( path, self._ListInclude( path ), mtime )
includes = cache_entry[ 1] This looks like it should work. Comments from Reviewable |
Codecov Report
@@ Coverage Diff @@
## master #919 +/- ##
=========================================
+ Coverage 97.08% 97.1% +0.01%
=========================================
Files 88 89 +1
Lines 6904 6969 +65
=========================================
+ Hits 6703 6767 +64
- Misses 201 202 +1 |
Coverage can be improved, but before I get to writing more tests, do we want/need Review status: 0 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. Comments from Reviewable |
@bstaletic thanks a lot for continuing to work on this :) Review status: 0 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. Comments from Reviewable |
@davits No problem. You have done most of the work though. Also, since I can't test it, if you have the time give it another test. |
Tested, Acceleration confirmed! Review status: 0 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. Comments from Reviewable |
Thanks for testing! 👍
Did you test it with only system header caching? How does it behave if you
let it cache all headers?
…On Feb 15, 2018 4:29 PM, "Davit Samvelyan" ***@***.***> wrote:
Tested, Acceleration confirmed!
------------------------------
Review status: 0 of 5 files reviewed at latest revision, 3 unresolved
discussions, some commit checks failed.
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/valloric/ycmd/919#-:-L5P4AxBCN3rUVDw1MY5:b-lqjhgo>*
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#919 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHbkU4SiyKPXNVDZ9VcPVCr3RacMJ-dwks5tVE1PgaJpZM4R-cOC>
.
|
In my case there is no much difference, since almost all include paths are given with '-isystem', there are only 2 paths given with '-I'. I think it wouldn't hurt to also cache '-I' flags, that folders rarely change as well, in my case at least. Review status: 0 of 5 files reviewed at latest revision, 3 unresolved discussions, some commit checks failed. Comments from Reviewable |
Great, your include flags are the opposite of @puremourning's. I'll wait
for his test results and then update the PR appropriately.
Once again, thanks for testing.
…On Feb 15, 2018 4:46 PM, "Davit Samvelyan" ***@***.***> wrote:
In my case there is no much difference, since almost all include paths are
given with '-isystem', there are only 2 paths given with '-I'. I think it
wouldn't hurt to also cache '-I' flags, that folders rarely change as well,
in my case at least.
------------------------------
Review status: 0 of 5 files reviewed at latest revision, 3 unresolved
discussions, some commit checks failed.
------------------------------
*Comments from Reviewable
<https://reviewable.io:443/reviews/valloric/ycmd/919#-:-L5P6qQHf1vh016n_1IP:b-dg2wxp>*
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#919 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AHbkUwws6fPnqXinNMhA1t6gZizzYzCMks5tVFFzgaJpZM4R-cOC>
.
|
01c8e1f
to
94bfbe2
Compare
I've pushed the tests. This is ready, unless someone has more to say. Review status: 0 of 6 files reviewed at latest revision, 3 unresolved discussions. ycmd/completers/cpp/flags.py, line 678 at r2 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Okay, we are definitely caching everything. Comments from Reviewable |
7645100
to
096c02a
Compare
096c02a
to
fbd064b
Compare
I squashed the commits. Review status: 0 of 6 files reviewed at latest revision, 3 unresolved discussions. Comments from Reviewable |
☔ The latest upstream changes (presumably #974) made this pull request unmergeable. Please resolve the merge conflicts. |
dc20d6d
to
5ec9a2a
Compare
Conflicts resolved. |
Reviewed 1 of 3 files at r2, 1 of 2 files at r4, 4 of 6 files at r5, 1 of 1 files at r6, 3 of 3 files at r7, 3 of 3 files at r8. ycmd/completers/cpp/flags.py, line 669 at r6 (raw file):
ycmd/completers/cpp/include_cache.py, line 51 at r8 (raw file):
ycmd/completers/cpp/include_cache.py, line 76 at r8 (raw file):
ycmd/completers/cpp/include_cache.py, line 82 at r8 (raw file):
I think a lock is needed for this variable as it can be simultaneously updated by multiple threads in the Clang completer. ycmd/completers/cpp/include_cache.py, line 107 at r8 (raw file):
This raises a ycmd/completers/general/filename_completer.py, line 39 at r7 (raw file):
This comment is misleading. It makes the reader thinks it's specific to Qt. It's not. We should simply say that an entry can be simultaneously a file and a directory when completing include statements. ycmd/tests/clang/include_cache_test.py, line 129 at r8 (raw file):
Comments from Reviewable |
5ec9a2a
to
fc7f49b
Compare
Review status: 2 of 6 files reviewed at latest revision, 7 unresolved discussions, all commit checks successful. ycmd/completers/cpp/flags.py, line 669 at r6 (raw file): Previously, micbou wrote…
Done. ycmd/completers/cpp/include_cache.py, line 51 at r8 (raw file): Previously, micbou wrote…
Done. ycmd/completers/cpp/include_cache.py, line 76 at r8 (raw file): Previously, micbou wrote…
Done. ycmd/completers/cpp/include_cache.py, line 82 at r8 (raw file): Previously, micbou wrote…
Done, I believe. Feel free to tell me if I messed something up. ycmd/completers/cpp/include_cache.py, line 107 at r8 (raw file): Previously, micbou wrote…
I changed the ycmd/completers/general/filename_completer.py, line 39 at r7 (raw file): Previously, micbou wrote…
Done. ycmd/tests/clang/include_cache_test.py, line 129 at r8 (raw file): Previously, micbou wrote…
Done. Comments from Reviewable |
fc7f49b
to
be1e559
Compare
Reviewed 4 of 4 files at r9. ycmd/tests/clang/include_cache_test.py, line 44 at r10 (raw file):
Why are the name of the tests starting with Comments from Reviewable |
be1e559
to
ef954e7
Compare
Review status: 5 of 6 files reviewed at latest revision, 1 unresolved discussion. ycmd/tests/clang/include_cache_test.py, line 44 at r10 (raw file): Previously, micbou wrote…
You're right. Fixed. Comments from Reviewable |
Reviewed 1 of 1 files at r11. Comments from Reviewable |
Reviewed 2 of 6 files at r5. ycmd/completers/cpp/flags.py, line 673 at r5 (raw file):
bracket or perhaps bracketed ycmd/completers/cpp/include_cache.py, line 115 at r2 (raw file): Previously, bstaletic (Boris Staletic) wrote…
seems ok. We're not reading the time multiple times, but I think the other path means we don't set includes anymore ycmd/completers/cpp/include_cache.py, line 36 at r5 (raw file):
maybe use a named tuple ? saves on some code. meh. no need to change. ycmd/completers/cpp/include_cache.py, line 1 at r11 (raw file):
I suppose as you have made changes to this, you can claim some copyright ownership as well? ycmd/completers/cpp/include_cache.py, line 98 at r11 (raw file):
not ? or "is not None" ? Do we want "falsy" to trigger here? ycmd/completers/cpp/include_cache.py, line 108 at r11 (raw file):
do we mutate cache_entry? if so we provably need to hold the lock until we have made any modifications. Otherwise there is a race condition where you acquire a pointer to the entry, then someone else does the same, then you update the list, then someone else updates the list. Probably not the end of the world if it happens (we just update the cache 2x rather than blocking). Hmm 🤔 ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file):
includes doesn't get set in this branch ycmd/completers/cpp/include_cache.py, line 123 at r11 (raw file):
any reason not to _logger.exception this ? if not, let's comment that "the directory no longer exists or is no longer accessible, it must be empty" or something/ Comments from Reviewable |
Reviewed 1 of 6 files at r5, 1 of 3 files at r8, 3 of 4 files at r9, 1 of 1 files at r11. Comments from Reviewable |
ef954e7
to
7f75f47
Compare
Review status: 4 of 6 files reviewed at latest revision, 8 unresolved discussions. ycmd/completers/cpp/flags.py, line 673 at r5 (raw file): Previously, puremourning (Ben Jackson) wrote…
Done. ycmd/completers/cpp/include_cache.py, line 115 at r2 (raw file): Previously, puremourning (Ben Jackson) wrote…
Yeah, that's what I ended up doing. ycmd/completers/cpp/include_cache.py, line 36 at r5 (raw file): Previously, puremourning (Ben Jackson) wrote…
Done. ycmd/completers/cpp/include_cache.py, line 1 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
Done. ycmd/completers/cpp/include_cache.py, line 98 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
Upon reading this again I was sure you were right. In this method
ycmd/completers/cpp/include_cache.py, line 108 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
We potentially mutate the cache in case the new ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
Done. ycmd/completers/cpp/include_cache.py, line 123 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
Done. Comments from Reviewable |
Review status: 4 of 6 files reviewed at latest revision, 3 unresolved discussions. ycmd/completers/cpp/include_cache.py, line 1 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
I think Synopsis is the company @davits works for, so it should be kept attached. ycmd/completers/cpp/include_cache.py, line 108 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
I'm sure it's fine. Worst case is we stash the dir 2x in a very unlikely race condition ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Is there a way to add a test for this? I guess it is a bit of a gap. ycmd/completers/cpp/include_cache.py, line 44 at r12 (raw file):
I feel like field names should be a list. This is totally legit, but I find the way named tuple allows whitespace or comma separated strings unusual! Anyway, no action required. Comments from Reviewable |
Reviewed 2 of 2 files at r12. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. ycmd/completers/cpp/include_cache.py, line 1 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
I had no idea. Fixed. ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
There is a ycmd/completers/cpp/include_cache.py, line 44 at r12 (raw file): Previously, puremourning (Ben Jackson) wrote…
Done. This is what happens when you implement something base on the first blog post you find. I didn't know until now that python had named tuples. Comments from Reviewable |
7f75f47
to
4dc0fd2
Compare
Review status: 5 of 6 files reviewed at latest revision, 3 unresolved discussions. ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Check the results ? ycmd/completers/cpp/include_cache.py, line 44 at r12 (raw file): Previously, bstaletic (Boris Staletic) wrote…
hehe ycmd/tests/clang/include_cache_test.py, line 135 at r13 (raw file):
Rereading the code, I think this was succeeding because We could in theory prove it with mocking, but it's probably not worth it. Comments from Reviewable |
Reviewed 1 of 1 files at r13. Comments from Reviewable |
Review status: all files reviewed at latest revision, 4 unresolved discussions. ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file): Previously, puremourning (Ben Jackson) wrote…
The results of ycmd/tests/clang/include_cache_test.py, line 135 at r13 (raw file): Previously, puremourning (Ben Jackson) wrote…
Yup, you're completely right, though I'm not sure what to mock. Comments from Reviewable |
Review status: all files reviewed at latest revision, 3 unresolved discussions. ycmd/completers/cpp/include_cache.py, line 112 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Sorry I meant to delete that comment, after adding the other one about the test. Comments from Reviewable |
Reviewed 2 of 2 files at r12, 1 of 1 files at r13. ycmd/completers/cpp/include_cache.py, line 123 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
ycmd/completers/cpp/include_cache.py, line 142 at r13 (raw file):
Same comment. Comments from Reviewable |
4dc0fd2
to
b190ec7
Compare
Review status: 5 of 6 files reviewed at latest revision, 4 unresolved discussions. ycmd/completers/cpp/include_cache.py, line 123 at r11 (raw file): Previously, micbou wrote…
Done. ycmd/completers/cpp/include_cache.py, line 142 at r13 (raw file): Previously, micbou wrote…
Done. Comments from Reviewable |
Reviewed 1 of 1 files at r14. ycmd/completers/cpp/include_cache.py, line 123 at r11 (raw file): Previously, bstaletic (Boris Staletic) wrote…
Sorry, I missed this but we shouldn't format the string when logging. Instead, we should do: _logger.exception( 'The directory %s no longer exists or is inaccessible.', path ) Also, I think the message should give more context e.g. ycmd/completers/cpp/include_cache.py, line 142 at r13 (raw file): Previously, bstaletic (Boris Staletic) wrote…
The message here could be Comments from Reviewable |
b190ec7
to
55d3997
Compare
Review status: 5 of 6 files reviewed at latest revision, 4 unresolved discussions. ycmd/completers/cpp/include_cache.py, line 123 at r11 (raw file): Previously, micbou wrote…
Done. ycmd/completers/cpp/include_cache.py, line 142 at r13 (raw file): Previously, micbou wrote…
Done. Comments from Reviewable |
Nice work. @zzbot r+ Reviewed 1 of 1 files at r15. Comments from Reviewable |
📌 Commit 55d3997 has been approved by |
[READY] Cache include paths Since @davits said he won't be able to finish #873, I've updated his PR according to the review comments. All credits go to @davits for actually doing all the work here. <!-- 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/919) <!-- Reviewable:end -->
☀️ Test successful - status-appveyor, status-travis |
[READY] Update ycmd Include the following changes: - PR ycm-core/ycmd#919: cache include paths; - PR ycm-core/ycmd#1013: increase Python 2 requirement to 2.7.1; - PR ycm-core/ycmd#1015: force MSVC to treat source files as UTF-8 encoded; - PR ycm-core/ycmd#1017: bundle and compile the regex module; - PR ycm-core/ycmd#1020: use `sysconfig` instead of `distutils.sysconfig` in build script. Fixes #3001. Fixes #3007. <!-- 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/3010) <!-- Reviewable:end -->
Since @davits said he won't be able to finish #873, I've updated his PR according to the review comments.
All credits go to @davits for actually doing all the work here.
This change is