From 1c81950dcbc2258d4821c0bd5126d31e03122602 Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Mon, 21 Mar 2022 15:47:57 +0900
Subject: [PATCH 1/9] #pragma("",off|on) in sources aren't friendly to pragma
in headers
---
Include/pyport.h | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/Include/pyport.h b/Include/pyport.h
index 62ac0989d3f154..0a878dd7960354 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -182,11 +182,10 @@ typedef Py_ssize_t Py_ssize_clean_t;
*/
#if defined(_MSC_VER)
-# if defined(PY_LOCAL_AGGRESSIVE)
+# if defined(PY_LOCAL_AGGRESSIVE) && !defined(Py_DEBUG)
/* enable more aggressive optimization for MSVC */
- /* active in both release and debug builds - see bpo-43271 */
-# pragma optimize("gt", on)
-#endif
+ /* MSBuild scripting is preferable to optimize pragmas in headers */
+# endif
/* ignore warnings if the compiler decides not to inline a function */
# pragma warning(disable: 4710)
/* fastest possible local call under MSVC */
From 9c1f3a5e387eefc265179d5669b1354b74fb7da6 Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Mon, 21 Mar 2022 15:49:18 +0900
Subject: [PATCH 2/9] StackReserveSize 4000000 for Debug
---
PCbuild/python.vcxproj | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/PCbuild/python.vcxproj b/PCbuild/python.vcxproj
index 77bccde69e3ba3..11f835aecea7dc 100644
--- a/PCbuild/python.vcxproj
+++ b/PCbuild/python.vcxproj
@@ -94,7 +94,8 @@
Console
- 2000000
+ 2000000
+ 4000000
From 691870f3bbe0c66964cedb72633702783fda5bf0 Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Mon, 21 Mar 2022 15:50:22 +0900
Subject: [PATCH 3/9] StackReserveSize 4000000 for _freeze_module
---
PCbuild/_freeze_module.vcxproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
index 0a74f5850a1e8e..96d1edd5dfbc86 100644
--- a/PCbuild/_freeze_module.vcxproj
+++ b/PCbuild/_freeze_module.vcxproj
@@ -96,6 +96,7 @@
Console
version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)
Default
+ 4000000
From 1ebe5f482a26aaf07d1911726cdfca9f8b9a1a4b Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Mon, 21 Mar 2022 15:51:26 +0900
Subject: [PATCH 4/9] remove a comment in ceval.c
---
Python/ceval.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/Python/ceval.c b/Python/ceval.c
index 6f449e3172d083..f69e2cd1f6aa9a 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -6,7 +6,6 @@
*/
/* enable more aggressive intra-module optimizations, where available */
-/* affects both release and debug builds - see bpo-43271 */
#define PY_LOCAL_AGGRESSIVE
#include "Python.h"
From 413cb1d142a04155adf8d2e70eef4da9f9adcfea Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Mon, 21 Mar 2022 19:44:18 +0900
Subject: [PATCH 5/9] _freeze_module with /Ob0 (no inline)
---
PCbuild/_freeze_module.vcxproj | 1 +
1 file changed, 1 insertion(+)
diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
index 96d1edd5dfbc86..4fff7e218addd7 100644
--- a/PCbuild/_freeze_module.vcxproj
+++ b/PCbuild/_freeze_module.vcxproj
@@ -91,6 +91,7 @@
Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)
Disabled
false
+ Disabled
Console
From 00c6e05252bd5fe2a370569e81a88e8586cef448 Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Tue, 22 Mar 2022 04:49:32 +0900
Subject: [PATCH 6/9] _freeze_module with default inlining
---
PCbuild/_freeze_module.vcxproj | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
index 4fff7e218addd7..817e966084afdb 100644
--- a/PCbuild/_freeze_module.vcxproj
+++ b/PCbuild/_freeze_module.vcxproj
@@ -91,7 +91,7 @@
Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)
Disabled
false
- Disabled
+ Default
Console
From a47f8bb88c328b879176f756fc25187d8ad53237 Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Tue, 22 Mar 2022 06:47:03 +0900
Subject: [PATCH 7/9] Update pyport.h
---
Include/pyport.h | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/Include/pyport.h b/Include/pyport.h
index 0a878dd7960354..855c382a61ee53 100644
--- a/Include/pyport.h
+++ b/Include/pyport.h
@@ -170,22 +170,12 @@ typedef Py_ssize_t Py_ssize_clean_t;
* Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining,
* for platforms that support that.
*
- * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more
- * "aggressive" inlining/optimization is enabled for the entire module. This
- * may lead to code bloat, and may slow things down for those reasons. It may
- * also lead to errors, if the code relies on pointer aliasing. Use with
- * care.
- *
* NOTE: You can only use this for functions that are entirely local to a
* module; functions that are exported via method tables, callbacks, etc,
* should keep using static.
*/
#if defined(_MSC_VER)
-# if defined(PY_LOCAL_AGGRESSIVE) && !defined(Py_DEBUG)
- /* enable more aggressive optimization for MSVC */
- /* MSBuild scripting is preferable to optimize pragmas in headers */
-# endif
/* ignore warnings if the compiler decides not to inline a function */
# pragma warning(disable: 4710)
/* fastest possible local call under MSVC */
From 2a15be87ee636adc0dbdc83ddfb8500796bdf27e Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Tue, 22 Mar 2022 06:48:08 +0900
Subject: [PATCH 8/9] Update ceval.c
---
Python/ceval.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/Python/ceval.c b/Python/ceval.c
index f69e2cd1f6aa9a..8226476b1f438e 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5,9 +5,6 @@
XXX document it!
*/
-/* enable more aggressive intra-module optimizations, where available */
-#define PY_LOCAL_AGGRESSIVE
-
#include "Python.h"
#include "pycore_abstract.h" // _PyIndex_Check()
#include "pycore_call.h" // _PyObject_FastCallDictTstate()
From 6e85c1fc4c82b7370b4858bafeef7de3605382f4 Mon Sep 17 00:00:00 2001
From: neonene <53406459+neonene@users.noreply.github.com>
Date: Tue, 22 Mar 2022 09:23:22 +0900
Subject: [PATCH 9/9] revert _freeze_module.vcxproj
---
PCbuild/_freeze_module.vcxproj | 2 --
1 file changed, 2 deletions(-)
diff --git a/PCbuild/_freeze_module.vcxproj b/PCbuild/_freeze_module.vcxproj
index 817e966084afdb..0a74f5850a1e8e 100644
--- a/PCbuild/_freeze_module.vcxproj
+++ b/PCbuild/_freeze_module.vcxproj
@@ -91,13 +91,11 @@
Py_NO_ENABLE_SHARED;Py_BUILD_CORE;_CONSOLE;%(PreprocessorDefinitions)
Disabled
false
- Default
Console
version.lib;ws2_32.lib;pathcch.lib;bcrypt.lib;%(AdditionalDependencies)
Default
- 4000000