1
votes

I am using an i7-7700HQ CPU @ 2.8GHz. However, after I installed visual studio code and set its C++ compiler from the visual studio community 2019, I got a very slow performance even running the simple program hello world.

It took me 1 minute to compile and 2 minutes to run the program. For instance, when I typed cl test.cpp, I have to wait 1 minute for it to finish compiling. Then I would type test.exe, another 2 minutes.

Here is my hello world program stored on the desktop.


#include <iostream> 
void main()
{
    std::cout << "Hello World!";
}

Then for a 60 line program, I will have to wait 4 minutes for it to compile and even longer to run. I find it very unusual, please let me know if there is any bug or problem in the program. Or if there are any solutions to this problem.

My process explorer image: My process explorer image

PE while running the program: PE while running the program

1
Check your task manager to see if any other application is taking up a lot of memory/processing time on your computer. - JohnFilleau
My first guess would be anti virus - Alan Birtles
I recommend using Microsoft Defender as your antivirus protection. It is quite robust, and Microsoft has strong incentive to have it perform well. - Eljay
@Willy add the directories of your project to the excluded directories: community.f-secure.com/t5/F-Secure-SAFE/… - DragonGamer
The question is clear and concise. minimal reproducible example is given. The OP showed effort to solve the problem. It's not directly related to C++ but it is (indirectly), and it's a common problem which may occur to other C++ developers as well (entry level or not). I find it worth to be archived - would enjoy it earns some upvotes. The OP might provide a self-answer which he may accept (later). - Scheff's Cat

1 Answers

0
votes

From other users' comments, I've finalised the problem to be F-secure security software interfering with VSC.

Tried unloading it has reduced the compile and run time significantly. However, the exclusion list method does not work as well as unloading. There might be another solution after I've asked the official F-secure support team!

Thanks everyone :)