Index: Tools/pybench/Numbers.py =================================================================== --- Tools/pybench/Numbers.py (revision 67706) +++ Tools/pybench/Numbers.py (working copy) @@ -1,5 +1,86 @@ from pybench import Test +class IntBitLength_UniformOutput(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 IntBitLength_UniformInput(Test): + version = 2.0 + operations = 20 * 20 + rounds = 10000 + test_values = [1547928873, 1770135447, 1152600834, 2073678290, 511953789, + 2100165328, 1182551414, 1086548642, 1280639457, 124023220, + 515619866, 1404351191, 531150276, 81906556, 1373139822, + 1641379362, 971885338, 466929527, 1815706654, 386438689] + + 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