C:\user\perlmonks>perl 11153747.pl 15 32768 0.0403292179107666 0.0388741493225098 v5.38.0 C:\user\perlmonks>perl 11153747.pl 16 65536 0.0916790962219238 0.0764880180358887 v5.38.0 C:\user\perlmonks>perl 11153747.pl 17 131072 0.361366987228394 0.142138957977295 v5.38.0 C:\user\perlmonks>perl 11153747.pl 18 262144 1.22035908699036 0.37365198135376 v5.38.0 C:\user\perlmonks>perl 11153747.pl 19 524288 4.05149698257446 0.628846883773804 v5.38.0 C:\user\perlmonks>perl 11153747.pl 20 1048576 21.3440728187561 3.00999999046326 v5.38.0 #### use strict; use warnings; use feature 'say'; use Time::HiRes 'time'; my $n = 2**$ARGV[0]; say $n; my $x = 'a' x ($n-1); my $y = 'b' . $x; my $t = time; $x =~ s/./$&-/g; say time - $t; $t = time; $y =~ s/./$&-/g; say time - $t; say $^V; __END__