-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Optimize handling of globs from extension searches #75314
Comments
Seems to me like |
If |
@roblourens If that is how it's supposed to work (and I think it is) then there is a regression. The
When I open the workspace, the multiple When I include
|
It looks like you have the setting |
That panel is empty even after changing the log level. I'm not running any searches. I'm just opening a workspace in VS Code. |
There are extensions triggering searches or being activated on a glob pattern which also triggers a search, if you change the log level and reload the window, you should see them. I want to see if there are any other hints about why |
@roblourens I took the liberty of sending the log to your gmail. I was pretty confident that I verified this with extensions disabled, but was unable to when I tried it now :( |
Thanks, I see what's going on, I forgot that .gitignore and search.exclude are not considered for extension-triggered searches. It has always been this way, changing it now would just be a breaking change, and some extensions rely on this. #68056 So unfortunately all I can say is that you can add these folders to |
Yeah, I figure it's https://github.com/hbenl/vscode-mocha-test-adapter I've been using this for some time now. I'm surprised this behavior is so noticeable now but has been unchanged from the last update :/ Including But I'll look into possible ways to work around the problematic behavior via the configuration options of the extension, as there shouldn't really be any reason to look into Thanks for the support. |
Looking at the code, it looks like the extension makes several other checks before triggering a search. You might check whether one of those can help you to avoid the search entirely. https://github.com/hbenl/vscode-mocha-test-adapter/blob/40a8b1beb4f1f9790efb20f87aeb52b766a84408/src/configReader.ts#L180 Or if this is a workspace where you are not using this extension, extensions can be disabled per-workspace. Alternately it could be a bug with the extension. |
We handle the ripgrep issue that you identified in some cases - for text searches that use the For a search like the one in this case, I can in theory apply the same optimization. It's often really tricky to get this right without breaking something but I'm all for anything that decreases the impact of extension searches. |
IMHO the entire issues is a result from trying to abstract away too much of the complexity of search. Sometimes you want the convenience of not including files matched by As I understand it, the API in VS Code currently allows only 2 relevant arguments to target a search: One inclusive pattern and one exclusive pattern. The remaining ways to further specify the search are set outside of the scope of the search request, which should already be undesirable in itself. The result of the search must then be filtered down further as desired. This is not ideal. First a tool, that prides itself on performance ( Another aspect is, In any case, thanks again for your help, which ultimately resulted in a solution implemented by the extension author, resolving the problem in this specific case. And I also learned a bit more about ripgrep :) |
I do have an open issue to expose more options to the findFiles extension API but that extension wouldn't want to exclude gitignore and search.excude files all the time, that was a problem in this issue: #68056. But yeah extensions should be able to use that in their searches.
Not sure, I think rg will use all the resources available, whether there is one process at a time or 5. That is not a bad thing, you paid for a fast CPU, let's use it :) Thanks for following up with the extension author, I think just excluding node_modules is a good workaround too. |
I'd rather trust a single instance of I have been involved or followed many tickets revolving around performance/freeze issues in VS Code and When I run a single I manually exited This is only a single process. If 10 of those would be running for my entire workspace (and this is what was happening when I initially posted in this ticket), the system becomes unusable. I don't even want to think about what would happen if my system would have started to page out memory to disk. In the best-case scenario, people (or the extensions they are using) aren't searching for millions or billions of files and this use case should be perfectly served by single instances of In the worst-case scenario, people should at least be able to still control their system and not be locked out by processes running wild due to an error. Maybe running in series isn't even a good solution, I just experienced this so often now, that I felt maybe a better solution can be found and implemented. |
Hey @roblourens, hoping to get your help on this issue again in light of your recent fix in #138337 (comment).
I agree with the complexities of a fix here being a breaking change, and it was the main reason I hadn't commented before now. Noticing your other fix, would adding a default timeout here too be reasonable? I personally don't see many good reasons for extensions to search for files in the background for more than a few minutes, but it's possible I'm missing hidden complexity here. What are your thoughts? The problem was exacerbated after we switched to It looks like the change to respect 7s timeouts in the November 2021 release only applies to
For context, many members of my team have been running into this problem from extensions that fire off We first saw this in But since then we've isolated other extensions causing this problem. Ex:
Adding |
And this is because it's still spending time in node_modules? To be clear, this particular "optimize globs" issue wouldn't help with extensions searching for Thanks for sending a PR upstream to that extension. |
We believe so. In the
You're right, but I think it's also the case that the existing API makes it easy to accidentally search everything when I'm reading a bit more closely at the comments above and noticed that an update to the API was already considered:
Is the result of that this comment? #48674 (comment) I see the new API allows It seems like migrating to whatever new function accepts
Thanks for the suggestion that was a reasonable way to fix this. I would have felt unsure creating such a PR before reading your comment above. |
Yeah, new API will help here, I hope to get to it soon. |
closing as stale since there have been many API changes that have impacted performance. If you are still having problems with performance please file a new issue so we can address it in its current state. Thanks! |
Issue Type: Performance Issue
Opening project folders with vscode slows down
VS Code version: Code 1.35.0 (553cfb2, 2019-06-04T01:17:12.481Z)
OS version: Windows_NT x64 10.0.17763
System Info
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Process Info
Workspace Info
Extensions (8)
The text was updated successfully, but these errors were encountered: