Why is my new laptop's VS Code so slow for C programming?
Asked by
Pumice
I've just set up VS Code on my brand new HP Victus, which has an i7 13th Gen processor, 24GB of RAM, and a 1TB SSD. I'm trying to use GCC/MinGW for my C programming. I wrote a simple program that reverses a word using arraysโnothing complicated at all. However, when I run it, VS Code either takes over 400 seconds to execute, freezes, or crashes with exit code=1.
I've already tried a bunch of things to fix this:
1. Uninstalled Code Runner
2. Moved all project files out of OneDrive
3. Ran VS Code as an administrator
4. Tried both CMD and PowerShell
5. Compiled directly from the terminal instead of using the Run button
6. Cleaned up my tasks.json file
7. Double-checked my actual code
Despite everything, the issue persists. Since my laptop's hardware should handle this easily, I'm really at a loss. Has anyone experienced a similar issue or know how to fix it? I'd love to get back to coding without the wait.
Answers
Antivirus software can really slow down the performance by scanning every file each time they're accessed, especially for smaller files like C/C++ headers. Itโs worth checking if you have any antivirus running that might be impacting this. Disabling it might speed things up, even if it doesn't explain your terminal speed.
Reply to this answer
Curious if youโre using the standard version of VS Code or the Insiders edition? I find that the normal blue VS Code tends to work better for most setups. Just a thought!
Reply to this answer
You might consider switching to WSL2. I've found that GCC on Windows can be a real hassle. Using WSL2 or even MSVC with Visual Studio Community Edition might offer a smoother experience than mixing Windows, VS Code, and GCC, which can be a real headache.
Reply to this answer
When you compile and run your code directly from the terminal, does it execute quickly? If it runs fast there, it might be an issue specific to how VS Code is set up. If you find that itโs slow only when using the Run button in VS Code, thatโs definitely something to look into.
Pumice: Yeah, it runs instantly from the terminal! The lag only happens when I use the Run button in VS Code.
Reply to this answer
Have you checked where your compiler is installed? If itโs somehow inside OneDrive, moving it out could help. Sometimes, syncing services cause strange delays.
Pumice: Iโve already moved everything out of OneDrive, so that shouldnโt be the issue.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Pumice: Iโm using the normal one, not Insiders.