Dot-Net

“為什麼我的 .net exe 如此龐大”分析工具?

  • October 8, 2017

是否有工具可以解釋 .NET 程序集(執行檔或 DLL 文件)的大小?

在過去,有一個 IDE 擴展可以詳細說明項目使用的空間。

它應該顯示大程式碼文件:

在此處輸入圖像描述

和數據資源

在此處輸入圖像描述

.NET 世界有這樣的事情嗎?

我真的認為遷移到 .NET,不再需要將整個 VCL 建構到執行檔中,執行檔的大小會縮小。

獎金閱讀

標準 SDK 採用 ILDASM(IL Disassembler),在 View 菜單中有“Statistics”選項,將其分解如下:

File size            : 3072
PE header size       : 512 (456 used)    (16.67%)
PE additional info   : 167               ( 5.44%)
Num.of PE sections   : 2
CLR header size     : 72                 ( 2.34%)
CLR meta-data size  : 1572               (51.17%)
CLR additional info : 0                  ( 0.00%)
CLR method headers  : 15                 ( 0.49%)
Managed code         : 77                ( 2.51%)
Data                 : 512               (16.67%)
Unaccounted          : 145               ( 4.72%)

Num.of PE sections   : 2
  .text    - 2048
  .reloc   - 512

CLR meta-data size  : 1572
  Module        -    1 (10 bytes)
  TypeDef       -    4 (56 bytes)      0 interfaces, 0 explicit layout
  TypeRef       -   15 (90 bytes)
  MethodDef     -    4 (56 bytes)      0 abstract, 0 native, 4 bodies
  FieldDef      -    2 (12 bytes)      0 constant
  MemberRef     -   15 (90 bytes)
  ParamDef      -    4 (24 bytes)
  CustomAttribute-   13 (78 bytes)
  StandAloneSig -    1 (2 bytes)
  Assembly      -    1 (22 bytes)
  AssemblyRef   -    1 (20 bytes)
  Strings       -   571 bytes
  Blobs         -   336 bytes
  UserStrings   -     8 bytes
  Guids         -    16 bytes
  Uncategorized -   181 bytes

CLR method headers : 15
  Num.of method bodies  - 4
  Num.of fat headers    - 1
  Num.of tiny headers   - 3

Managed code : 77
  Ave method size - 19

這應該提供一個很好的起點。

引用自:https://stackoverflow.com/questions/9313442