The initial results on my machine are:
```
real 252 it/s
user 289 it/s
```
Signed-off-by: Michał Górny <
mgorny@gentoo.org>
---
eclass/tests/cargo-bench.sh | 107 ++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
create mode 100755 eclass/tests/cargo-bench.sh
diff --git a/eclass/tests/cargo-bench.sh b/eclass/tests/cargo-bench.sh
new file mode 100755
index 000000000000..cdc5e4431c14
--- /dev/null
+++ b/eclass/tests/cargo-bench.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+source tests-common.sh || exit
+
+export LC_ALL=C
+
+ITERATIONS=1000
+RUNS=3
+
+doit() {
+ for (( i = 0; i < ITERATIONS; i++ )); do
+ SRC_URI="
+ $(cargo_crate_uris)
+ "
+ done
+}
+
+timeit() {
+ local real=()
+ local user=()
+ local x vr avg
+
+ for (( x = 0; x < RUNS; x++ )); do
+ while read tt tv; do
+ case ${tt} in
+ real) real+=( ${tv} );;
+ user) user+=( ${tv} );;
+ esac
+ done < <( ( time -p doit ) 2>&1 )
+ done
+
+ [[ ${#real[@]} == ${RUNS} ]] || die "Did not get ${RUNS} rea