Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-35059 : Add /Ob1 flag when building pythoncore in debug mode #10094

Merged
merged 1 commit into from Oct 26, 2018

Conversation

@vstinner
Copy link
Member

commented Oct 25, 2018

Visual Studio solution: the "pythoncore" project is now compiled with
the /Ob1 flag in Debug mode to expand functions marked as inline.

https://bugs.python.org/issue35059

@vstinner vstinner requested review from zooba and zware Oct 25, 2018

@vstinner vstinner requested a review from python/windows-team as a code owner Oct 25, 2018

@vstinner

This comment has been minimized.

Copy link
Member Author

commented Oct 25, 2018

This change matters when you consider the PR #10079 which converts Py_INCREF() macro to a static inline function.

I'm not sure if it's ok to only modify pythoncore, or if the 38 other projects should be modified the same way?

On Unix, Python is now compiled with -Og:

       -Og Optimize debugging experience.  -Og enables optimizations that do
           not interfere with debugging. It should be the optimization level
           of choice for the standard edit-compile-debug cycle, offering a
           reasonable level of optimization while maintaining fast compilation
           and a good debugging experience.
@zware

This comment has been minimized.

Copy link
Member

commented Oct 25, 2018

You can instead add this to PCbuild/pyproject.props in the existing <ClCompile Condition="$(Configuration) == 'Debug'"> section that disables optimization globally in Debug configuration.

@vstinner

This comment has been minimized.

Copy link
Member Author

commented Oct 25, 2018

You can instead add this to PCbuild/pyproject.props in the existing section that disables optimization globally in Debug configuration.

Oh thanks, I will try that! I was looking for something similar, but I failed to find it in the Visual Studio UI.

@vstinner vstinner force-pushed the vstinner:msvc_Ob1 branch from ed3d60e to 3fb77ff Oct 26, 2018

@vstinner

This comment has been minimized.

Copy link
Member Author

commented Oct 26, 2018

You can instead add this to PCbuild/pyproject.props in the existing section that disables optimization globally in Debug configuration.

Oh, fantastic! I tried and it works as expected! It's exactly what I was looking for ;-) I didn't know pyproject.props.

bpo-35059, PCbuild: Expand inline funcs in Debug
Visual Studio solution: Set InlineFunctionExpansion to
OnlyExplicitInline ("/Ob1" option) on all projects (in
pyproject.props) in Debug mode on Win32 and x64 platforms to expand
functions marked as inline.

This change should make Python compiled in Debug mode a little bit
faster on Windows. On Unix, GCC uses -Og optimization level for
./configure --with-pydebug.

@vstinner vstinner force-pushed the vstinner:msvc_Ob1 branch from 3fb77ff to 248cfef Oct 26, 2018

@vstinner vstinner merged commit a05bef4 into python:master Oct 26, 2018

5 checks passed

Azure Pipelines PR #20181026.21 succeeded
Details
bedevere/issue-number Issue number 35059 found
Details
bedevere/news News entry found in Misc/NEWS.d
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@vstinner vstinner deleted the vstinner:msvc_Ob1 branch Oct 26, 2018

@bedevere-bot

This comment has been minimized.

Copy link

commented Oct 26, 2018

Hi! The buildbot AMD64 Windows7 SP1 3.x has failed when building commit a05bef4.

You can take a look here:

https://buildbot.python.org/all/#builders/40/builds/1057

@vstinner

This comment has been minimized.

Copy link
Member Author

commented Oct 26, 2018

Hi! The buildbot AMD64 Windows7 SP1 3.x has failed when building commit a05bef4.

Oh. I broke this buildbot for real :-( The compilation of the _decimal module fails:

            Creating library C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\amd64\_decimal_d.lib and object C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\amd64\_decimal_d.exp
    19>ClCompile:
         xmltok.c
    16>ClCompile:
         prep_cif.c
    21>ClCompile:
         multiprocessing.c
    19>ClCompile:
         Generating Code...
    17>_decimal.obj : error LNK2019: unresolved external symbol mpd_del referenced in function PyDec_AsTuple [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
    17>io.obj : error LNK2001: unresolved external symbol mpd_del [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
    17>basearith.obj : error LNK2019: unresolved external symbol mpd_uint_zero referenced in function _mpd_baseshiftl [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
    17>io.obj : error LNK2019: unresolved external symbol mpd_qresize referenced in function mpd_qset_string [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
    17>C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\amd64\_decimal_d.pyd : fatal error LNK1120: 3 unresolved externals [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
(...)
       "C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj" (Build target) (17) ->
       (Link target) -> 
         _decimal.obj : error LNK2019: unresolved external symbol mpd_del referenced in function PyDec_AsTuple [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
         io.obj : error LNK2001: unresolved external symbol mpd_del [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
         basearith.obj : error LNK2019: unresolved external symbol mpd_uint_zero referenced in function _mpd_baseshiftl [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
         io.obj : error LNK2019: unresolved external symbol mpd_qresize referenced in function mpd_qset_string [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
         C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\amd64\_decimal_d.pyd : fatal error LNK1120: 3 unresolved externals [C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\_decimal.vcxproj]
@bedevere-bot

This comment has been minimized.

Copy link

commented Oct 26, 2018

Hi! The buildbot AMD64 Windows8 3.x has failed when building commit a05bef4.

You can take a look here:

https://buildbot.python.org/all/#builders/32/builds/1639

@bedevere-bot

This comment has been minimized.

Copy link

commented Oct 26, 2018

Hi! The buildbot AMD64 Windows10 3.x has failed when building commit a05bef4.

You can take a look here:

https://buildbot.python.org/all/#builders/3/builds/1566

@vstinner

This comment has been minimized.

Copy link
Member Author

commented Oct 26, 2018

It seems like my PR #10128 fixed the linker error.

yahya-abou-imran added a commit to yahya-abou-imran/cpython that referenced this pull request Nov 2, 2018
bpo-35059, PCbuild: Expand inline funcs in Debug (pythonGH-10094)
Visual Studio solution: Set InlineFunctionExpansion to
OnlyExplicitInline ("/Ob1" option) on all projects (in
pyproject.props) in Debug mode on Win32 and x64 platforms to expand
functions marked as inline.

This change should make Python compiled in Debug mode a little bit
faster on Windows. On Unix, GCC uses -Og optimization level for
./configure --with-pydebug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.