summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2016-09-27 12:59:01 +0100
committerDavid Mitchell <davem@iabyn.com>2016-09-27 13:05:25 +0100
commit80e5abf23b986e2b06e8cd73a698f2f1cd26d991 (patch)
tree075a3fa5963ed1e046a845fe999b890c71d809c0 /t
parent032736abefdb7cfe5ccd540348d63d568c9bdc73 (diff)
downloadperl-80e5abf23b986e2b06e8cd73a698f2f1cd26d991.tar.gz
S_sv_2iuv_common(): optimise single digit strings
When converting a POK SV to an IOK SV, short-cut the relatively common case of a string that is only one char long and consists of a single digit, e.g. "0". Thus skipping all the floating-point, infinity, whitespace etc complexity.
Diffstat (limited to 't')
-rw-r--r--t/perf/benchmarks11
1 files changed, 11 insertions, 0 deletions
diff --git a/t/perf/benchmarks b/t/perf/benchmarks
index 6ea1ce882b..6c15523488 100644
--- a/t/perf/benchmarks
+++ b/t/perf/benchmarks
@@ -812,6 +812,17 @@
setup => 'my ($x,$y); ($x,$y,$z) = (1, 2.2, 3.3);',
code => '$z = $x + $y',
},
+ 'expr::arith::add_lex_ss' => {
+ desc => 'add two short strings and assign to a lexical var',
+ setup => 'my ($x,$y,$z) = ("1", "2", 1);',
+ code => '$z = $x + $y; $x = "1"; ',
+ },
+
+ 'expr::arith::add_lex_ll' => {
+ desc => 'add two long strings and assign to a lexical var',
+ setup => 'my ($x,$y,$z) = ("12345", "23456", 1);',
+ code => '$z = $x + $y; $x = "12345"; ',
+ },
'expr::arith::sub_lex_ii' => {
desc => 'subtract two integers and assign to a lexical var',