classification
Title: Pystone uses floats
Type: performance Stage:
Components: Benchmarks Versions: Python 3.5, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: lregebro, python-dev, vstinner
Priority: normal Keywords: patch

Created on 2014-06-02 09:27 by lregebro, last changed 2014-06-02 12:31 by lregebro. This issue is now closed.

Files
File name Uploaded Description Edit
pystone.diff lregebro, 2014-06-02 09:27 review
pystone12.diff lregebro, 2014-06-02 09:52 review
Messages (8)
msg219559 - (view) Author: Lennart Regebro (lregebro) Date: 2014-06-02 09:27
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.
msg219560 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-02 09:30
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).
msg219563 - (view) Author: Lennart Regebro (lregebro) Date: 2014-06-02 09:52
Yes, good point, I added this in a new diff.
msg219570 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-02 12:05
+                Unde Python 3 version 1.1 would use the normal division

I guess that it's a typo: "Under Python 3 ..."?
msg219571 - (view) Author: Lennart Regebro (lregebro) Date: 2014-06-02 12:06
Oups, yes, that's a typo.
msg219573 - (view) Author: Roundup Robot (python-dev) Date: 2014-06-02 12:18
New changeset 1318324aa93a by Victor Stinner in branch '3.4':
Issue #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 #21634: Fix pystone micro-benchmark: use floor division
http://hg.python.org/cpython/rev/95b7acdc0f24
msg219574 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-06-02 12:19
Thanks the patch, I fixed pystone in Python 3.4 and 3.5.
msg219577 - (view) Author: Lennart Regebro (lregebro) Date: 2014-06-02 12:31
Awesome, thanks!
History
Date User Action Args
2014-06-02 12:31:53lregebrosetmessages: + msg219577
2014-06-02 12:19:38vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg219574

versions: - Python 3.1, Python 3.2, Python 3.3
2014-06-02 12:18:26python-devsetnosy: + python-dev
messages: + msg219573
2014-06-02 12:06:16lregebrosetmessages: + msg219571
2014-06-02 12:05:19vstinnersetmessages: + msg219570
2014-06-02 09:52:19lregebrosetfiles: + pystone12.diff

messages: + msg219563
2014-06-02 09:30:08vstinnersetnosy: + vstinner
messages: + msg219560
2014-06-02 09:27:08lregebrocreate