Subject: | Type::Tiny code template isn't the most efficient way to use it |
Try comparing:
code_template => 'state $v = (<type:raw>)->compiled_check; $v->(<data>)'
Results on my laptop attached.
Subject: | bencher-results.txt |
# Run on: perl v5.26.2, CPU Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz (2 cores), OS GNU/Linux Ubuntu version 20.04, OS kernel: Linux version 5.4.0-42-generic
# Elapsed time: 0.21s
+-------------+---------------+----------+--------+-----------+-----------+------------+---------+---------+
| participant | dataset | arg_data | p_tags | rate (/s) | time (μs) | vs_slowest | errors | samples |
+-------------+---------------+----------+--------+-----------+-----------+------------+---------+---------+
| dsah | array10(dsah) | | dsah | 252000 | 3.97 | 1 | 1.5e-09 | 26 |
| tt | array10(tt) | | tt | 2120000 | 0.472 | 8.42 | 2.1e-10 | 20 |
| dsah | int(dsah) | 1 | dsah | 3674000 | 0.2722 | 14.6 | 9.3e-12 | 20 |
| dsah | int(dsah) | a | dsah | 3880000 | 0.258 | 15.4 | 1.1e-10 | 20 |
| dsah | int(dsah) | | dsah | 5600000 | 0.18 | 22 | 4.2e-10 | 20 |
| tt | int(tt) | | tt | 19000000 | 0.052 | 76 | 2.1e-10 | 20 |
| tt | int(tt) | 1 | tt | 20472800 | 0.0488453 | 81.3731 | 0 | 20 |
| tt | int(tt) | a | tt | 20485000 | 0.0488163 | 81.4215 | 0 | 20 |
+-------------+---------------+----------+--------+-----------+-----------+------------+---------+---------+