From a374a1c268bc838ecf2eab443f7b9f474a10a12e Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Tue, 4 Jul 2023 21:50:04 +0100 Subject: [PATCH] add tuple_into_py benchmark --- benches/bench_tuple.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/benches/bench_tuple.rs b/benches/bench_tuple.rs index e26c1700..a2988b15 100644 --- a/benches/bench_tuple.rs +++ b/benches/bench_tuple.rs @@ -83,6 +83,12 @@ fn tuple_to_list(b: &mut Bencher<'_>) { }); } +fn tuple_into_py(b: &mut Bencher<'_>) { + Python::with_gil(|py| { + b.iter(|| -> PyObject { (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12).into_py(py) }); + }); +} + fn criterion_benchmark(c: &mut Criterion) { c.bench_function("iter_tuple", iter_tuple); c.bench_function("tuple_new", tuple_new); @@ -92,6 +98,7 @@ fn criterion_benchmark(c: &mut Criterion) { c.bench_function("sequence_from_tuple", sequence_from_tuple); c.bench_function("tuple_new_list", tuple_new_list); c.bench_function("tuple_to_list", tuple_to_list); + c.bench_function("tuple_into_py", tuple_into_py); } criterion_group!(benches, criterion_benchmark);