Mojo struct
QuickBench
Defines a struct to facilitate benchmarking and avoiding Bencher
boilerplate.
Fields
- m (
Bench
): Bench object to collect the results.
Implemented traits
AnyType
Methods
__init__
__init__(out self)
Just initialize the Bench object.
dump_report
dump_report(self)
Prints out the report from a Benchmark execution collected in Bench object.
run
run[T_out: AnyTrivialRegType](inout self, func: fn() -> T_out, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with no input arguments and return type T_out
.
Parameters:
- T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn() -> T_out
): The function to be benchmarked (run in benchmark iterations). - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0) -> T_out, x0: T0, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 1 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1) -> T_out, x0: T0, x1: T1, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 2 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2) -> T_out, x0: T0, x1: T1, x2: T2, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 3 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 4 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, T4: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3, T4) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, x4: T4, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 5 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T4 (
AnyTrivialRegType
): Type of the 5th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3, T4) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - x4 (
T4
): The 5th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, T4: AnyTrivialRegType, T5: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3, T4, T5) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 6 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T4 (
AnyTrivialRegType
): Type of the 5th argument of func. - T5 (
AnyTrivialRegType
): Type of the 6th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3, T4, T5) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - x4 (
T4
): The 5th argument of func. - x5 (
T5
): The 6th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, T4: AnyTrivialRegType, T5: AnyTrivialRegType, T6: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3, T4, T5, T6) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 7 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T4 (
AnyTrivialRegType
): Type of the 5th argument of func. - T5 (
AnyTrivialRegType
): Type of the 6th argument of func. - T6 (
AnyTrivialRegType
): Type of the 7th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3, T4, T5, T6) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - x4 (
T4
): The 5th argument of func. - x5 (
T5
): The 6th argument of func. - x6 (
T6
): The 7th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, T4: AnyTrivialRegType, T5: AnyTrivialRegType, T6: AnyTrivialRegType, T7: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3, T4, T5, T6, T7) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 8 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T4 (
AnyTrivialRegType
): Type of the 5th argument of func. - T5 (
AnyTrivialRegType
): Type of the 6th argument of func. - T6 (
AnyTrivialRegType
): Type of the 7th argument of func. - T7 (
AnyTrivialRegType
): Type of the 8th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3, T4, T5, T6, T7) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - x4 (
T4
): The 5th argument of func. - x5 (
T5
): The 6th argument of func. - x6 (
T6
): The 7th argument of func. - x7 (
T7
): The 8th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, T4: AnyTrivialRegType, T5: AnyTrivialRegType, T6: AnyTrivialRegType, T7: AnyTrivialRegType, T8: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3, T4, T5, T6, T7, T8) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 9 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T4 (
AnyTrivialRegType
): Type of the 5th argument of func. - T5 (
AnyTrivialRegType
): Type of the 6th argument of func. - T6 (
AnyTrivialRegType
): Type of the 7th argument of func. - T7 (
AnyTrivialRegType
): Type of the 8th argument of func. - T8 (
AnyTrivialRegType
): Type of the 9th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3, T4, T5, T6, T7, T8) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - x4 (
T4
): The 5th argument of func. - x5 (
T5
): The 6th argument of func. - x6 (
T6
): The 7th argument of func. - x7 (
T7
): The 8th argument of func. - x8 (
T8
): The 9th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
run[T0: AnyTrivialRegType, T1: AnyTrivialRegType, T2: AnyTrivialRegType, T3: AnyTrivialRegType, T4: AnyTrivialRegType, T5: AnyTrivialRegType, T6: AnyTrivialRegType, T7: AnyTrivialRegType, T8: AnyTrivialRegType, T9: AnyTrivialRegType, /, T_out: AnyTrivialRegType](inout self, func: fn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) -> T_out, x0: T0, x1: T1, x2: T2, x3: T3, x4: T4, x5: T5, x6: T6, x7: T7, x8: T8, x9: T9, *, bench_id: BenchId, measures: List[ThroughputMeasure] = List())
Benchmark function func
with 10 input argument and return type T_out
.
Parameters:
- T0 (
AnyTrivialRegType
): Type of the 1st argument of func. - T1 (
AnyTrivialRegType
): Type of the 2nd argument of func. - T2 (
AnyTrivialRegType
): Type of the 3rd argument of func. - T3 (
AnyTrivialRegType
): Type of the 4th argument of func. - T4 (
AnyTrivialRegType
): Type of the 5th argument of func. - T5 (
AnyTrivialRegType
): Type of the 6th argument of func. - T6 (
AnyTrivialRegType
): Type of the 7th argument of func. - T7 (
AnyTrivialRegType
): Type of the 8th argument of func. - T8 (
AnyTrivialRegType
): Type of the 9th argument of func. - T9 (
AnyTrivialRegType
): Type of the 10th argument of func. - T_out (
AnyTrivialRegType
): Output type of func.
Args:
- func (
fn(T0, T1, T2, T3, T4, T5, T6, T7, T8, T9) -> T_out
): The function to be benchmarked (run in benchmark iterations). - x0 (
T0
): The 1st argument of func. - x1 (
T1
): The 2nd argument of func. - x2 (
T2
): The 3rd argument of func. - x3 (
T3
): The 4th argument of func. - x4 (
T4
): The 5th argument of func. - x5 (
T5
): The 6th argument of func. - x6 (
T6
): The 7th argument of func. - x7 (
T7
): The 8th argument of func. - x8 (
T8
): The 9th argument of func. - x9 (
T9
): The 10th argument of func. - bench_id (
BenchId
): The benchmark Id object used for identification. - measures (
List[ThroughputMeasure]
): Optional arg used to represent a list of ThroughputMeasure's.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!