From 76b30116a06bc8a696b5e190e9ead371cba34ecb Mon Sep 17 00:00:00 2001 From: David Mitchell Date: Fri, 28 Aug 2020 10:22:02 +0100 Subject: [PATCH] t/perf/benchmarks: tweak mixed arithmetic The benchmarks which test adding an int to a num weren't measuring correctly because, after the first iteration, the PVIV var got upgraded to a PVNV - thus causing the optimised 'both args NV' path to be chosen after that. Make the benchmark recreate the integer variable on each iteration --- t/perf/benchmarks | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/t/perf/benchmarks b/t/perf/benchmarks index 63eb62cfc3..6e76fe1a6e 100644 --- a/t/perf/benchmarks +++ b/t/perf/benchmarks @@ -952,12 +952,14 @@ }, 'expr::arith::add_lex_ni' => { desc => 'add an int and an NV and assign to a lexical var', - setup => 'my ($x,$y,$z) = (1, 2.2, 3.3);', + setup => 'my ($y,$z) = (2.2, 3.3);', + pre => 'my $x = 1', # after 1st iter gets upgraded to PVNV code => '$z = $x + $y', }, 'expr::arith::add_pkg_ni' => { desc => 'add an int and an NV and assign to a package var', - setup => 'my ($x,$y); ($x,$y,$z) = (1, 2.2, 3.3);', + setup => 'my ($y); ($y,$z) = (2.2, 3.3);', + pre => 'my $x = 1', # after 1st iter gets upgraded to PVNV code => '$z = $x + $y', }, 'expr::arith::add_lex_ss' => {