First execution of a freshly compiled program is very slow, next executions are fast enough, I suspect it is related to the mac trying to verify the binary, but I'd rather avoid this process as I compile files very frequently and I know (at least from files compiled by myself) that they are not harmful.
The most common scenario for me is as follow:
- Write small program in c++ (let's say simple hello world
a.cpp) - Compile (
g++ -std=c++11 a.cpp -o sol) - Execute it for first time
./sol(takes in the order of 5 seconds) - Execute it again
./sol(gives output instantly as expected)
I already saw few related questions, however I was unable to solve the problem: