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

Pystone uses floats #65833

Closed
regebro mannequin opened this issue Jun 2, 2014 · 8 comments
Closed

Pystone uses floats #65833

regebro mannequin opened this issue Jun 2, 2014 · 8 comments
Labels
performance Performance or resource usage

Comments

@regebro
Copy link
Mannequin

regebro mannequin commented Jun 2, 2014

BPO 21634
Nosy @vstinner, @regebro
Files
  • pystone.diff
  • pystone12.diff
  • 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 2014-06-02.12:19:38.018>
    created_at = <Date 2014-06-02.09:27:08.544>
    labels = ['performance']
    title = 'Pystone uses floats'
    updated_at = <Date 2014-06-02.12:31:53.513>
    user = 'https://github.com/regebro'

    bugs.python.org fields:

    activity = <Date 2014-06-02.12:31:53.513>
    actor = 'lregebro'
    assignee = 'none'
    closed = True
    closed_date = <Date 2014-06-02.12:19:38.018>
    closer = 'vstinner'
    components = ['Benchmarks']
    creation = <Date 2014-06-02.09:27:08.544>
    creator = 'lregebro'
    dependencies = []
    files = ['35442', '35443']
    hgrepos = []
    issue_num = 21634
    keywords = ['patch']
    message_count = 8.0
    messages = ['219559', '219560', '219563', '219570', '219571', '219573', '219574', '219577']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'lregebro', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue21634'
    versions = ['Python 3.4', 'Python 3.5']

    @regebro
    Copy link
    Mannequin Author

    regebro mannequin commented Jun 2, 2014

    Pystone uses some floats in Python 3, while in Python 2 it's all integers. And since it is, as far as I can tell, based on Dhrystone, it should be all ints.

    After fixing the division in the loop to be a floor division it runs the same as in Python 2. I've verified that after the attached fix the only floats created are time stamps, so this seems to be all that's needed.

    This also makes the benchmark run c:a 5% faster, lessening the speed difference in pystone between Python 2 and Python 3, which contributes to the misconception that Python 3 is horribly slow.

    @regebro regebro mannequin added performance Performance or resource usage labels Jun 2, 2014
    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2014

    According to the name of variables ("IntLoc2 = IntLoc3 // IntLoc1"), I agree that integers should be used. Since the performances can be different between int and float, you should change the version and explain your change in the changelog (in the top docstring).

    @regebro
    Copy link
    Mannequin Author

    regebro mannequin commented Jun 2, 2014

    Yes, good point, I added this in a new diff.

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2014

    + Unde Python 3 version 1.1 would use the normal division

    I guess that it's a typo: "Under Python 3 ..."?

    @regebro
    Copy link
    Mannequin Author

    regebro mannequin commented Jun 2, 2014

    Oups, yes, that's a typo.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 2, 2014

    New changeset 1318324aa93a by Victor Stinner in branch '3.4':
    Issue bpo-21634: Fix pystone micro-benchmark: use floor division instead of true
    http://hg.python.org/cpython/rev/1318324aa93a

    New changeset 95b7acdc0f24 by Victor Stinner in branch 'default':
    (Merge 3.4) Issue bpo-21634: Fix pystone micro-benchmark: use floor division
    http://hg.python.org/cpython/rev/95b7acdc0f24

    @vstinner
    Copy link
    Member

    vstinner commented Jun 2, 2014

    Thanks the patch, I fixed pystone in Python 3.4 and 3.5.

    @vstinner vstinner closed this as completed Jun 2, 2014
    @regebro
    Copy link
    Mannequin Author

    regebro mannequin commented Jun 2, 2014

    Awesome, thanks!

    @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
    performance Performance or resource usage
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant