Skip to content

Commit

Permalink
win32/Makefile: update compilation flags for Visual C++
Browse files Browse the repository at this point in the history
Makefile contains the following comment from 2002:

  # -O1 yields smaller code, which turns out to be faster than -O2

Visual C++ documentation says that -O2 "creates fast code", while -O1
"creates small code". It's unlikely that, after 20 years, -O2 still
generates worse code. If it does, it should be reported to Microsoft.

Also added -Gw (optimize global data).
  • Loading branch information
xenu committed Oct 14, 2024
1 parent 77b7888 commit 5dc8a4d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions win32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,7 @@ DEFINES = $(DEFINES) -D_DEBUG -DDEBUGGING
EXTRACFLAGS = $(EXTRACFLAGS) -MDd
!ELSE
# Enable Whole Program Optimizations (WPO) and Link Time Code Generation (LTCG).
# -O1 yields smaller code, which turns out to be faster than -O2 on x86 and x64
OPTIMIZE = -O1 -Zi -GL
OPTIMIZE = -O2 -Zi -GL -Gw
# we enable debug symbols in release builds also
LINK_DBG = -debug -opt:ref,icf -ltcg
# you may want to enable this if you want COFF symbols in the executables
Expand Down

0 comments on commit 5dc8a4d

Please sign in to comment.