2025年12月4日 星期四

[研究]Visual Studio 的「 Incredibuild - 建置加速」用途?

[研究]Visual Studio 的「 Incredibuild - 建置加速」用途?

2025-12-04

下圖,Visual Studio 2019的 Incredibuild - 建置加速


下圖,Visual Studio 2022 Installer

下圖,Visual Studio 2026 Installer

ChatGPT

🔍 Visual Studio 2019 的「Incredibuild - 建置加速」是做什麼用的?

簡單一句話:Incredibuild 是一套分散式平行編譯系統,用來大幅加速 C/C++、C#、Unity、Android、遊戲引擎等的建置(Build) 速度。

它不是 Microsoft 開發的,而是 Visual Studio 2019 內建的 外掛 (Extension),但必須另外安裝 Incredibuild(試用版可用)。

⚡ 主要用途

1. 分散式編譯 (Distributed Build)

如果公司內部有多台電腦(甚至虛擬機),Incredibuild 可利用其他電腦的 CPU 來幫忙建置專案。例如:
  • 本機 8 核心
  • 其他電腦提供 40 核心
=> 建置時你瞬間擁有 48 核心

適用範圍:
  • C/C++(最有效果,VS/Clang 皆可)
  • C#/MSBuild(改善不如 C++ 大,但仍能加速)
  • 嵌入式/Driver 程式
  • 3D/遊戲引擎(如 Unreal Engine)
  • Android NDK
  • Unity
2. 加速 Visual Studio Build 與 Rebuild

尤其在大型 C++ Solution 中,重建(Rebuild)可能要 10–60 分鐘;啟用後可能縮到 2–10 分鐘。

**因為:**大部分建置工作可分散出去跑。

3. 最大加值:PCH、Clang、Link 也能加速

含:
  • Precompiled headers(會拆分併行)
  • Linking(LINK 也能部分併行)
  • Resource compilation
  • Code Analysis
🛠 Visual Studio 中 Incredibuild 的功能位置

在 VS 2019 中,你會看到:

Incredibuild
 ├─ Build
 ├─ Rebuild
 ├─ Stop Build
 └─ Management Console

若未安裝 Incredibuild 本體,這些選項會無法使用。

📦 使用是否需要額外安裝?

✔ Visual Studio 附的是「VS Integration」
✘ 但 核心服務(Agent / Coordinator)必須安裝 Incredibuild 主程式 才能運作

三種角色:
角色 用途
Coordinator 控制整個分散式編譯的任務排程(可安裝在一台 Server)
Agent(含 Helper Agent) 提供可用 CPU 核心(建置工作在此執行)
Visual Studio Extension 讓開發者可透過 VS 啟用 Incredibuild

📈 有沒有實際加速效果?

官方實測:
專案類型 未使用 使用後
UE4(大型 C++) 30–60 分鐘 5–15 分鐘
大型 C# + MSBuild 8–12 分鐘 約 2–6 分鐘
Android NDK 20–40 分鐘 5–12 分鐘

👉 如果你是 C++ 或遊戲開發,Incredibuild 的效果是「爆炸性提高」。
👉 若你是 C#/.NET WebForm,提升有限(通常 10%~40%)。

❗ 你需要 Incredibuild 嗎?(直接給你判斷)
如果你是以下情況 → 非常適合

✔ 大量 C/C++
✔ UE4 / CryEngine / Unity
✔ Android NDK
✔ 每天 build 超過 20 分鐘
✔ 團隊多台電腦,想善用 CPU

如果你是以下情況 → 改善有限

⚠ ASP.NET WebForm(C#)
⚠ WinForm / WPF(C#)
⚠ Console / 小規模專案
⚠ Fortify SCA / SonarQube 掃描(跟 Incredibuild 無關)

💡 環境(Jenkins + Fortify + WebForm)適用嗎?

➡ Incredibuild 對 Fortify / Jenkins / WebForm 幾乎沒有幫助
因為 Fortify 的 Sourceanalyzer 並不是 Visual Studio 編譯器,所以無法透過 Incredibuild 加速。

對 ASP.NET WebForm (C#) 的 MSBuild 加速提升也很有限。

📝 總結

問題 答案
Visual Studio 2019 的 Incredibuild 是做什麼? 分散式平行編譯,加速建置
要不要額外安裝? 要,VS 只裝介面,需要 Incredibuild 主程式
加速效果? C++ 明顯,大型 C# 中度,小型專案有限
對 Fortify/Jenkins 有幫助嗎? 幾乎沒有

(完)

沒有留言:

張貼留言