diff --git a/benchmark/benchmarking.py b/benchmark/benchmarking.py index 68a2433..08b37ef 100644 --- a/benchmark/benchmarking.py +++ b/benchmark/benchmarking.py @@ -324,12 +324,13 @@ def update(self): def auto_number(self) -> int: assert self.is_auto_number - for expo in itertools.count(3): - for n in (1, 2, 5): - self.number = n * 10**expo - runtime = self.run().runtime + for self.number in auto_number_series(): + with temp_log(): + log(numerize(self.number, decimals=1), False) + runtime = min(self.run().runtime for _ in range(5)) if runtime > AUTO_NUMBER_TARGET_TIME: return runtime + self.number = int(self.number * 1.1) def run(self) -> "TestCaseResult": log(".", False) diff --git a/benchmark/utils.py b/benchmark/utils.py index 110c501..a3cc43c 100644 --- a/benchmark/utils.py +++ b/benchmark/utils.py @@ -31,11 +31,18 @@ "log", "indent_log", "temp_log", - "iter_identity" + "iter_identity", + "auto_number_series" ) SourceLines = Tuple[str, ...] +def auto_number_series() -> Generator[int, None, None]: + for expo in itertools.count(2): + # E12 series + for value in (10, 12, 15, 18, 22, 27, 33, 39, 47, 56, 68, 82): + yield value * 10 ** expo + def indent(src: SourceLines) -> SourceLines: return tuple(" "*4 + line for line in src)