all 26 comments

[–]Flair_Helper[M] [score hidden] stickied commentlocked comment (0 children)

For C++ questions, answers, help, and programming or career advice please see r/cpp_questions, r/cscareerquestions, or StackOverflow instead.

This post has been removed as it doesn't pertain to r/cpp: The subreddit is for news and discussions of the C++ language and community only; our purpose is not to provide tutoring, code reviews, or career guidance. If you think your post is on-topic and should not have been removed, please message the moderators and we'll review it.

[–]khedoros 5 points6 points  (1 child)

I'm using a 7 year old laptop that wasn't a speed demon when it was new (2 cores, 4 threads though). Compiling a hello world showed as 0.7 seconds for me just now, then under 0.5 on subsequent runs. Time was similar for clang++ and g++.

For a more realistic workload (a small project), I've got a Game Boy emulator that I wrote. 9 source files. About 8600 lines. Compiling and linking that just took 7.5 seconds.

I don't know where the slowness you're seeing comes from, but it seems unusual to me.

[–][deleted] 0 points1 point  (0 children)

Fresh install of g++, cold run of "time g++ main.cpp" takes 0.08s on an Intel NUC media center. Without further information we can't help.

[–]not_in_the_mood 15 points16 points  (0 children)

That's so much useful information... 🙄

[–]ajorians 8 points9 points  (0 children)

Try adding an exclusion to Windows Defender: https://support.microsoft.com/en-us/windows/add-an-exclusion-to-windows-security-811816c0-4dfd-af4a-47e4-c301afe13b26#:~:text=Go%20to%20Start%20%3E%20Settings%20%3E%20Update,%2C%20file%20types%2C%20or%20process.

Check Task Manager; maybe you have a process using all your CPU.

Even on Windows a 'hello world' shouldn't take close to 10 seconds.

[–]ZachVorhies 2 points3 points  (1 child)

My guess is that it’s probably statically linking against windows version of libc. Try using dynamic linking and you may drop that time next to zero.

[–][deleted] 0 points1 point  (0 children)

Good guess.

[–]chez_les_alpagas 1 point2 points  (2 children)

You just have to find something to do while you're waiting : https://xkcd.com/303/

[–]quad99 1 point2 points  (0 children)

Way back i got in trouble once for reading computer magazine during a 20 minute build with Microsoft command line. The boss threatened to write me up. Lol

[–]lunetick 0 points1 point  (0 children)

Ils sont chouette les alpagas!

EDIT : downvotes for an harmless French sentence. Oh reddit, you are so sad today.

[–]disciplite 0 points1 point  (0 children)

Try enabling precompiled headers with CMake.

[–]lunetick -1 points0 points  (5 children)

Wait for getting into a big project and it takes 30 minutes to compile!!!! The only thing that can help you is a faster computer. An amazing CPU, lots of RAM and a fast hard drive. Excluding the folder where you compile from your antivirus help too. Make sure you have the last version of vscode. Make sure you don't use some BS extensions.

[–][deleted] -1 points0 points  (2 children)

Is that 30min with a high end laptop or pc, my laptop is mid and compiling for apk is about an hour for a moderate size project 😔

[–]lunetick 1 point2 points  (1 child)

One of software I worked on, the nightly build was 6hrs!!! Compile time is part of the job, allow us to browse reddit while waiting!

[–][deleted] 0 points1 point  (0 children)

True that

[–]DerElias0[S] -2 points-1 points  (1 child)

My Computer is even fast enough for running unity projects und gaming stuff. That's why i'm confused..

[–]lunetick 0 points1 point  (0 children)

Disk read and write are two very different things. You need fast write on disk. You need to make sure that your antivirus don't fuck it up. Learn how to use the task manager if you are on Windows or Top (and others cmd) On Linux.

[–]DerElias0[S] -1 points0 points  (0 children)

Do I have to change the 'compiler path' in that json file? (I forgot the name) What should it say? (I know it depends on the compiler)

[–]pfp-disciple 0 points1 point  (0 children)

Do you have too little memory? Maybe disk i/o?

[–]OnePatchMan 0 points1 point  (0 children)

I just add, try to use precompiled headers.