From 6bc0fe62b60157a937917d533069ec5672746ed7 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 6 Sep 2021 17:19:39 +0200 Subject: [PATCH] bpo-45115: Enable optimiaztions on Windows debug build On Windows, enable compiler optimizations on the debug build to make tests run faster and to reduce the stack memory usage, especially with static inline functions used in Python public header files. The Windows GitHub Actions now build Python in debug mode to catch more bugs. --- .github/workflows/build.yml | 8 ++++---- Doc/whatsnew/3.11.rst | 5 +++++ .../next/Build/2021-09-06-17-22-14.bpo-45115.4n0_eo.rst | 3 +++ PCbuild/pythoncore.vcxproj | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Build/2021-09-06-17-22-14.bpo-45115.4n0_eo.rst diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27e07a5f91bf37..3a32b1fe4e39e0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -95,11 +95,11 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build CPython - run: .\PCbuild\build.bat -e -p Win32 + run: .\PCbuild\build.bat -e -p Win32 -d - name: Display build info run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -p Win32 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + run: .\PCbuild\rt.bat -p Win32 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 build_win_amd64: name: 'Windows (x64)' @@ -111,11 +111,11 @@ jobs: - name: Register MSVC problem matcher run: echo "::add-matcher::.github/problem-matchers/msvc.json" - name: Build CPython - run: .\PCbuild\build.bat -e -p x64 + run: .\PCbuild\build.bat -e -p x64 -d - name: Display build info run: .\python.bat -m test.pythoninfo - name: Tests - run: .\PCbuild\rt.bat -p x64 -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 + run: .\PCbuild\rt.bat -p x64 -d -q -uall -u-cpu -rwW --slowest --timeout=1200 -j0 build_macos: name: 'macOS' diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 896a292c3356e8..c861324e909127 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -284,6 +284,11 @@ CPython bytecode changes Build Changes ============= +* On Windows, enable compiler optimizations on the debug build to make tests + run faster and to reduce the stack memory usage, especially with static + inline functions used in Python public header files. + (Contributed by Victor Stinner in :issue:`45115`.) + Deprecated ========== diff --git a/Misc/NEWS.d/next/Build/2021-09-06-17-22-14.bpo-45115.4n0_eo.rst b/Misc/NEWS.d/next/Build/2021-09-06-17-22-14.bpo-45115.4n0_eo.rst new file mode 100644 index 00000000000000..01dc50ca0aca78 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2021-09-06-17-22-14.bpo-45115.4n0_eo.rst @@ -0,0 +1,3 @@ +On Windows, enable compiler optimizations on the debug build to make tests +run faster and to reduce the stack memory usage, especially with static +inline functions used in Python public header files. diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index b8cadf469355f4..a2881fa302a6e2 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -104,6 +104,8 @@ $(zlibDir);%(AdditionalIncludeDirectories) _USRDLL;Py_BUILD_CORE;Py_BUILD_CORE_BUILTIN;Py_ENABLE_SHARED;MS_DLL_ID="$(SysWinVer)";%(PreprocessorDefinitions) _Py_HAVE_ZLIB;%(PreprocessorDefinitions) + MaxSpeed + Default version.lib;shlwapi.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)