Mac中编译后的首次执行速度很慢

刚编译的程序的第一次执行非常慢,接下来的执行足够快,我怀疑它与试图验证二进制文件的mac有关,但是我宁愿避免此过程,因为我经常编译文件,而且我知道至少来自我自己编译的文件),它们无害。

对我而言,最常见的情况如下:

  • 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)

我已经看到了几个相关的问题,但是我无法解决该问题: