Calculation of the number of pystones equivalent to one second is inaccurate

Bug #836371 reported by Arnaud Fontaine
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.testbrowser
Invalid
Undecided
Unassigned

Bug Description

The current implementation is highly inaccurate because the number of loops is not high enough, for example:

>>> for i in range(30):
... print pystone.pystones(pystone.LOOPS/10)[1]
...
83333.3333333
100000.0
100000.0
125000.0
100000.0
100000.0
100000.0
100000.0
125000.0
100000.0
100000.0
100000.0
100000.0
125000.0
100000.0
100000.0
100000.0
100000.0
100000.0
100000.0
125000.0
100000.0
125000.0
100000.0
100000.0
125000.0
125000.0
125000.0
125000.0
125000.0

However, when using the defaults number of loops, the value is much more accurate:

>>> for i in range(30):
... print pystone.pystones()[1]
...
102040.816327
104166.666667
102040.816327
100000.0
100000.0
100000.0
102040.816327
100000.0
96153.8461538
94339.6226415
98039.2156863
100000.0
98039.2156863
94339.6226415
102040.816327
100000.0
100000.0
102040.816327
102040.816327
100000.0
100000.0
100000.0
100000.0
100000.0
98039.2156863
100000.0
100000.0
102040.816327
102040.816327
106382.978723

As the pystones per second value is only computed once, I think that it should not be a problem to use the default number of loops (namely 50000). Therefore, could you please apply the attached patch? Thanks.

Revision history for this message
Arnaud Fontaine (arnaud-fontaine) wrote :
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope.testbrowser project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope.testbrowser.

Changed in zope.testbrowser:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.