Using the following code I get some strange results:
import timeit
def test(s):
result = 0
for c in s:
result += ord(c)
return result
t = timeit.Timer("test('dennisbenzinger')", "from __main__ import test")
print t.repeat(number=50000)
Most of the time I get a result like
[3.3263199652469799, 3.3338471789012294, 3.3557058229467716] with all execution times are about 3.
But sometimes I get something like [3.3410785448988629, 4802.7882074397721, 1203.1983464378854]
where one or two execution times are much higher than the other
ones, although the program took about the same time to execute
and certainly not some thousand times as long...
I'm running Python 2.3.2 on Windows 2000 with ServicePack 4