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

Add configure option to disable Py3k warnings #49612

Closed
collinwinter mannequin opened this issue Feb 24, 2009 · 9 comments
Closed

Add configure option to disable Py3k warnings #49612

collinwinter mannequin opened this issue Feb 24, 2009 · 9 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage

Comments

@collinwinter
Copy link
Mannequin

collinwinter mannequin commented Feb 24, 2009

BPO 5362
Nosy @malemburg, @loewis, @brettcannon, @pitrou, @ezio-melotti
Files
  • no_py3k_warning.patch: Against trunk r69987
  • 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 2010-09-01.21:52:17.449>
    created_at = <Date 2009-02-24.22:54:42.720>
    labels = ['interpreter-core', 'performance']
    title = 'Add configure option to disable Py3k warnings'
    updated_at = <Date 2010-09-01.21:52:17.448>
    user = 'https://bugs.python.org/collinwinter'

    bugs.python.org fields:

    activity = <Date 2010-09-01.21:52:17.448>
    actor = 'brett.cannon'
    assignee = 'jyasskin'
    closed = True
    closed_date = <Date 2010-09-01.21:52:17.449>
    closer = 'brett.cannon'
    components = ['Interpreter Core']
    creation = <Date 2009-02-24.22:54:42.720>
    creator = 'collinwinter'
    dependencies = []
    files = ['13184']
    hgrepos = []
    issue_num = 5362
    keywords = ['patch', 'needs review']
    message_count = 9.0
    messages = ['82683', '82685', '82693', '82737', '82738', '98465', '98466', '111829', '115337']
    nosy_count = 9.0
    nosy_names = ['lemburg', 'loewis', 'brett.cannon', 'collinwinter', 'pitrou', 'jyasskin', 'stutzbach', 'ezio.melotti', 'BreamoreBoy']
    pr_nums = []
    priority = 'normal'
    resolution = 'out of date'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue5362'
    versions = ['Python 2.7']

    @collinwinter
    Copy link
    Mannequin Author

    collinwinter mannequin commented Feb 24, 2009

    The attached patch adds a --with-py3k-warnings option to configure.
    Passing --without-py3k-warnings disables all Py3k compatibility warnings
    (the default is to keep the warnings). For production deployments where
    performance is more important than warnings no-one will see, this can
    provide a useful performance improvement:

    2to3 (translate 2to3's source tree five times):
    Min: 22.406 -> 22.114: 1.32% faster
    Avg: 22.439 -> 22.158: 1.27% faster

    Django (render a 150x150 table 100 times):
    Min: 0.595 -> 0.586: 1.58% faster
    Avg: 0.598 -> 0.588: 1.76% faster

    Spitfire (render a 1000x1000 table 100 times):
    Min: 0.752 -> 0.743: 1.29% faster
    Avg: 0.754 -> 0.745: 1.25% faster

    Unpickle (unpickling a list of 8000 dicts 100 times):
    Min: 0.305 -> 0.301: 1.41% faster
    Avg: 0.307 -> 0.302: 1.49% faster

    Build env: gcc 4.3.1 x86_64 on Linux 2.6.18 (Core2 Duo)

    @collinwinter collinwinter mannequin assigned jyasskin Feb 24, 2009
    @collinwinter collinwinter mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage labels Feb 24, 2009
    @loewis
    Copy link
    Mannequin

    loewis mannequin commented Feb 24, 2009

    I would like to understand the problem better first. I find it hard to
    believe that mere access to a global (even if frequent) costs so much. I
    think we should strive to make the warnings check faster if it indeed
    produces significant runtime costs, rather than offering to remove it.

    @jyasskin
    Copy link
    Mannequin

    jyasskin mannequin commented Feb 25, 2009

    s/Leaving/Turning/ in configure.in.

    It looks like the convention for other --with flags that default to
    enabled is to document them as --with(out)-xxx. (except tsc...) I guess
    it's probably even better just to say what the default is in the
    documentation.

    "Trade away speed for Py3k compat warnings" is a bit harsh for a 1.5%
    penalty. How about "Define to get Py3k compatibility warnings at the
    cost of a little speed"?

    @collinwinter
    Copy link
    Mannequin Author

    collinwinter mannequin commented Feb 26, 2009

    Jeffrey: updated the patch to address your concerns.

    Martin: I'm not sure I completely understand it either, though it seems
    similar to bpo-4477. In the course of developing this patch, I tried
    also #ifdef'ing out all usages of the Py_Py3kWarningFlag global. This
    actually made things slower by around 5% across all the benchmarks I
    tested. Could be pipeline stalls or a code size issue, I really don't know.

    I'm not 100% convinced that something like this should go into CPython,
    as a different compiler/hardware combination could well render it moot.
    I mostly wanted a record of it, in case those few Python deployments
    with homogeneous compilers/hardware across their machines that might
    care about 1% better performance are interested.

    @collinwinter
    Copy link
    Mannequin Author

    collinwinter mannequin commented Feb 26, 2009

    Bah, forgot to run autoreconf. Fixed.

    @pitrou
    Copy link
    Member

    pitrou commented Jan 28, 2010

    Given the very small benefits, I don't think there's any point in making this a configuration variable. A hardcoded flag would be sufficient, and expert users would be able to recompile their Python (as with the FAST_LOOPS flag).

    @malemburg
    Copy link
    Member

    I'm with Antoine on this one.

    Also, instead of removing the flag completely which will cause problems with extensions relying on it, I'd suggest to just disable the PyErr_WarnPy3k(msg, stacklevel) macro and turn it into a no-op if a compile time variable DISABLE_PY3K_WARNINGS (or similar) is defined (which should be undefined per default).

    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Jul 28, 2010

    Both msg98465 and msg98466 agree that this should not be a configuration variable. I think a new patch is needed which follows the suggested solutions from the two messages given.

    @stutzbach
    Copy link
    Mannequin

    stutzbach mannequin commented Sep 1, 2010

    Since this issue doesn't apply in Python 3 and (as I understand it) the 2.7 branch is only open to bug fixes, can we close this performance issue?

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants