Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Why so big?

yumeyao edited this page May 6, 2012 · 3 revisions

Why is your putty.exe so much bigger than the stock PuTTY?

  • Stock 0.62 (built with VS2003): 472kb

  • Plain rebuild with VS2010: 516kb (+44kb)

  • Plus some standard optimisations (+ /GL): 530kb (+14kb)

  • Plus some standard safety checks (+ /GS /Gy /dynamicbase /D_CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES): 530kb (+0kb)

  • Plus debug information (+ /Zi /debug): 615kb (+85kb)

  • Plus icons: 744kb (+128kb)

  • Plus signature: 749kb (+5kb)

  • Plus original PuTTYTray patches: 836kb (+87kb)

  • Plus changes through p0.62-t010: 838kb (+2kb)

  • Compiling instead for x64: 988kb (+150kb).

  • Compressing with upx 3.0.8 --best and re-signing: 461kb (~1/2 size)

YumeYao's comments:

  • I'd like to comment that by using dynamic libc (MSVCRT) for linkage, the size can be reduced by ~50kb.
  • using dynamic libc requires VC6 compatible header files and libs (Win2003 SP1 DDK for VC7 & VC8, Win 7 DDK for VC9, don't know about VC10). By using VC6 comptible files, the resulting exe only requires MSVCRT.dll to run, which is on most systems, rather than msvcr70/71/80/90/100.dll.
  • Also from my experience, VC7 (VS2003) & VC8 (VS2005) performs best as a C compiler. Notice it's C not C++. VC9 (VS2008) & VC10 (VS2010) mainly provide an up-to-date CLR(.NET) code generation. In C/C++ scope, they improve C++ compiling time and add support for slightly more C++ features. So I don't see any benefits from compiling C with VC9/VC10.
  • You can disassemble object files to check the code quality. You'll see a lot of redundant instructions by VC9/VC10, which I suspect caused by CLR pseudo instructions being 'translated' into native code.
  • Currently I could say that VC7 mainly outperforms VC8 as integer multiplication are carefully turned into 'lea' instructions. (ex. lea eax, [eax+eax*4] equals to imul eax, 5, the former executes faster.) I think even the lame VC6 would handle these things correctly, don't know why VC8 has such a serious regression.
  • While VC8 mainly outperforms VC7 in condition combination & code position judgement. Much less jmp backwards ensures lower cache missing rate.