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

Bug #836371 reported by Arnaud Fontaine on 2011-08-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zope.testbrowser
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.

This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers