nodejs-testing icon indicating copy to clipboard operation
nodejs-testing copied to clipboard

Slow to discover tests

Open OliverJAsh opened this issue 1 year ago • 7 comments

Hi! Firstly, thank you for this extension. ❤️

I have just enabled this extension for my large work project and I've noticed that it takes quite a long time to discover tests, even when I'm using nodejs-testing.include to narrow the scope to a smaller folder.

Can you recommend a method for me to debug why this is taking so long? Perhaps the extension is running a command to discover test files. Is there a way to see the generated command?

Thanks!

OliverJAsh avatar Aug 21 '24 18:08 OliverJAsh

An extension profile would be useful: https://github.com/microsoft/vscode/wiki/Performance-Issues#profile-the-running-extensions

connor4312 avatar Aug 21 '24 18:08 connor4312

I don't see anything in the profile:

CPU-20240823T110900.217Z.cpuprofile.txt

image

To illustrate my problem, see this screen recording:

https://github.com/user-attachments/assets/6af89057-02c2-4ad2-81ec-4b6e0f2ec237

OliverJAsh avatar Aug 23 '24 11:08 OliverJAsh

Nothing much interesting there. This extension uses the VS Code findFiles and then the file watcher APIs to discover tests, it's possible that is running slow. You might also see the search functionality in VS Code be slow if that's the case.

VS Code implements this by shelling out to ripgrep under the hood, and occasionally software like antivirus and endpoint protection can make that run unusually slow

connor4312 avatar Aug 23 '24 17:08 connor4312

Thanks for the reply.

I'm not seeing slowness anywhere else. I also don't have any antivirus or endpoint protection running on my system.

It could be helpful to log which patterns about being passed into findFiles.

OliverJAsh avatar Aug 23 '24 17:08 OliverJAsh

Yea, I can also add some logging there if I see it's taking a while. Since I don't see AST parsing taking any time in your profile (the next step after finding files before publishing them to vs code) it's my assumption that that's being slow.

connor4312 avatar Aug 23 '24 18:08 connor4312

I'm curious if you see any difference with version 1.6.2 which uses the TS Language Features to do the parsing.

connor4312 avatar Dec 08 '24 01:12 connor4312

Thanks for the update. I just tested it and unfortunately it seems the same. My CPU goes to 100% for about 6/7 seconds due to multiple rg processes.

Let me know if there's anything else I can provide.

It could be helpful to log which patterns about being passed into findFiles.

I still think this would be useful.

OliverJAsh avatar Dec 09 '24 21:12 OliverJAsh