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

Use -Og for debug builds #67633

Closed
pitrou opened this issue Feb 11, 2015 · 11 comments
Closed

Use -Og for debug builds #67633

pitrou opened this issue Feb 11, 2015 · 11 comments
Labels
build The build process and cross-build tests Tests in the Lib/test dir type-feature A feature request or enhancement

Comments

@pitrou
Copy link
Member

pitrou commented Feb 11, 2015

BPO 23445
Nosy @pitrou, @vstinner, @serhiy-storchaka
Files
  • og.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2015-02-11.18:41:42.454>
    created_at = <Date 2015-02-11.16:28:42.352>
    labels = ['type-feature', 'tests', 'build']
    title = 'Use -Og for debug builds'
    updated_at = <Date 2019-10-02.16:57:46.429>
    user = 'https://github.com/pitrou'

    bugs.python.org fields:

    activity = <Date 2019-10-02.16:57:46.429>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2015-02-11.18:41:42.454>
    closer = 'pitrou'
    components = ['Build', 'Tests']
    creation = <Date 2015-02-11.16:28:42.352>
    creator = 'pitrou'
    dependencies = []
    files = ['38098']
    hgrepos = []
    issue_num = 23445
    keywords = ['patch']
    message_count = 11.0
    messages = ['235754', '235755', '235756', '235757', '235759', '235760', '235763', '235764', '239406', '239407', '353754']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'vstinner', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue23445'
    versions = ['Python 3.4', 'Python 3.5']

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 11, 2015

    Recent gcc versions have an optimization level named "-Og". It enables all optimizations that do not break debugging. Here is a patch that uses it on debug builds.

    Without the patch I get the following time for the whole test suite:

    $ time ./python -m test -j12
    [...]
    real	3m51.670s
    user	11m53.039s
    sys	0m28.300s

    With the patch it goes down to:

    real 2m36.378s
    user 7m13.743s
    sys 0m29.728s

    So the test suite is 33% faster to pass.

    @pitrou pitrou added build The build process and cross-build tests Tests in the Lib/test dir type-feature A feature request or enhancement labels Feb 11, 2015
    @serhiy-storchaka
    Copy link
    Member

    Most slow tests are skipped without -uall.

    As for the patch, may be use AX_CHECK_COMPILE_FLAG [1]?

    [1] http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 11, 2015

    -uall, without patch:

    real 5m47.290s
    user 18m28.405s
    sys 0m29.493s

    -uall, with patch:

    real 3m35.132s
    user 10m26.345s
    sys 0m30.351s

    That's a 38% speedup.

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 11, 2015

    As for the patch, may be use AX_CHECK_COMPILE_FLAG [1]?

    It's not used elsewhere in configure.ac. I reused the idiom used a couple lines above.

    @serhiy-storchaka
    Copy link
    Member

    This looks pretty harmless. Some slow buildbots run tests very long time and failed with timeout after 3600 seconds. May be this patch will make them faster.

    Yet one advantage -- the code compiled with partial optimization will be closer to the code compiled with full optimization. Therefore debugging version could catch more bugs that exist only with optimization.

    But may be apply this only to 3.5?

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 11, 2015

    I'd like to apply it to 3.4 as well, because it makes development more pleasant.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 11, 2015

    New changeset e37b201297d2 by Antoine Pitrou in branch '3.4':
    Issue bpo-23445: pydebug builds now use "gcc -Og" where possible, to make the resulting executable faster.
    https://hg.python.org/cpython/rev/e37b201297d2

    New changeset 527ed5205806 by Antoine Pitrou in branch 'default':
    Issue bpo-23445: pydebug builds now use "gcc -Og" where possible, to make the resulting executable faster.
    https://hg.python.org/cpython/rev/527ed5205806

    @pitrou
    Copy link
    Member Author

    pitrou commented Feb 11, 2015

    Done. It shouldn't break anything.

    @pitrou pitrou closed this as completed Feb 11, 2015
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 27, 2015

    New changeset c663dbb84c8c by Victor Stinner in branch '3.4':
    Issue bpo-23445: Fix test.support.python_is_optimized() for CFLAGS=-Og
    https://hg.python.org/cpython/rev/c663dbb84c8c

    New changeset 5b5a22b9327b by Victor Stinner in branch '2.7':
    Issue bpo-23445: Fix test_gdb.python_is_optimized() for CFLAGS=-Og
    https://hg.python.org/cpython/rev/5b5a22b9327b

    @vstinner
    Copy link
    Member

    Done. It shouldn't break anything.

    You're change skipped some test_gdb tests. I fixed the check in test_gdb/test.support.

    @vstinner
    Copy link
    Member

    vstinner commented Oct 2, 2019

    I created bpo-38350 to propose to revert this change.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    build The build process and cross-build tests Tests in the Lib/test dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants