Index: Tools/pybench/Numbers.py =================================================================== --- Tools/pybench/Numbers.py (revision 67706) +++ Tools/pybench/Numbers.py (working copy) @@ -1,5 +1,47 @@ from pybench import Test +class BitLength(Test): + version = 2.0 + operations = 20 * 20 + rounds = 10000 + + test_values = [8042, 701, 3608, 48482274, 9209662, 306563951, 14900, 1, + 13462, 2674032, 1360580410, 50, 358, 877, 29567507, + 92011332, 2301, 235617304, 3365284, 92829] + + def test(self): + L = self.test_values + for i in xrange(self.rounds): + for t in L: + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + t.bit_length() + + def calibrate(self): + L = self.test_values + for i in xrange(self.rounds): + for t in L: + pass + + + class CompareIntegers(Test): version = 2.0