connor4312 / nodejs-testing

VS Code integration for node:test native tests
MIT License
48 stars 7 forks source link

Slow to discover tests #52

Open OliverJAsh opened 3 weeks ago

OliverJAsh commented 3 weeks ago

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!

connor4312 commented 3 weeks ago

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

OliverJAsh commented 3 weeks ago

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

connor4312 commented 2 weeks ago

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

OliverJAsh commented 2 weeks ago

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.

connor4312 commented 2 weeks ago

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.