简体   繁体   English

Visual C ++的第二次编译速度比第一次更快?

[英]Visual C++ compiles faster second time than first time?

Why does this code compile within two very different time ranges in Visual Studio 2015: 为什么此代码在Visual Studio 2015中的两个非常不同的时间范围内进行编译:

#include "stdafx.h"
#include <Windows.h>
#include <iostream>


int main()
{
}

The first compilation is done in 1.49 seconds, and the second compilation is done in 0.15 seconds - why? 第一次编译在1.49秒内完成,第二次编译在0.15秒内完成-为什么? I have not touched any precompilation settings, so I wonder why this is happening. 我没有触摸任何预编译设置,所以我想知道为什么会这样。

From the official man page : 官方手册页

Choose Build or Build Solution to compile only those project files and components that have changed since the most recent build. 选择“生成”或“生成解决方案”以仅编译自最近一次生成以来已更改的那些项目文件和组件。

So on the second build it does nothing, because there were no changes. 因此,在第二个构建中,它没有任何作用,因为没有更改。

Choose Rebuild Solution to "clean" the solution and then build all project files and components. 选择“重建解决方案”以“清理”解决方案,然后构建所有项目文件和组件。

So if you rebuild the solution the build times should be consistent. 因此,如果您重新构建解决方案,则构建时间应该是一致的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM