Show More
@@ -79,7 +79,11 b' class TimeitResult(object):' | |||
|
79 | 79 | self._precision = precision |
|
80 | 80 | |
|
81 | 81 | def _repr_pretty_(self, p , cycle): |
|
82 | unic = u"%d loops, best of %d: %s per loop" % (self.loops, self.repeat, | |
|
82 | if self.loops == 1: # No s at "loops" if only one loop | |
|
83 | unic = u"%d loop, best of %d: %s per loop" % (self.loops, self.repeat, | |
|
84 | _format_time(self.best, self._precision)) | |
|
85 | else: | |
|
86 | unic = u"%d loops, best of %d: %s per loop" % (self.loops, self.repeat, | |
|
83 | 87 | _format_time(self.best, self._precision)) |
|
84 | 88 | p.text(u'<TimeitResult : '+unic+u'>') |
|
85 | 89 | |
@@ -956,7 +960,7 b' python-profiler package from non-free.""")' | |||
|
956 | 960 | In [5]: import time |
|
957 | 961 | |
|
958 | 962 | In [6]: %timeit -n1 time.sleep(2) |
|
959 |
1 loop |
|
|
963 | 1 loop, best of 3: 2 s per loop | |
|
960 | 964 | |
|
961 | 965 | |
|
962 | 966 | The times reported by %timeit will be slightly higher than those |
@@ -1055,8 +1059,12 b' python-profiler package from non-free.""")' | |||
|
1055 | 1059 | if worst > 4 * best and best > 0 and worst > 1e-6: |
|
1056 | 1060 | print("The slowest run took %0.2f times longer than the " |
|
1057 | 1061 | "fastest. This could mean that an intermediate result " |
|
1058 |
"is being cached |
|
|
1059 | print(u"%d loops, best of %d: %s per loop" % (number, repeat, | |
|
1062 | "is being cached." % (worst / best)) | |
|
1063 | if number == 1: # No s at "loops" if only one loop | |
|
1064 | print(u"%d loop, best of %d: %s per loop" % (number, repeat, | |
|
1065 | _format_time(best, precision))) | |
|
1066 | else: | |
|
1067 | print(u"%d loops, best of %d: %s per loop" % (number, repeat, | |
|
1060 | 1068 | _format_time(best, precision))) |
|
1061 | 1069 | if tc > tc_min: |
|
1062 | 1070 | print("Compiler time: %.2f s" % tc) |
General Comments 0
You need to be logged in to leave comments.
Login now