use strict; use warnings; use Benchmark qw(cmpthese); print "perl version $] \n"; my $rx = qr{X}xms; cmpthese(-1, { 'qr_bound' => sub { 'Y' =~ $rx ; }, 'qr_interp' => sub { 'Y' =~ / $rx / ; }, 'qr_interp_o' => sub { 'Y' =~ / $rx /o; }, 'm_empty' => sub { 'Y' =~ //; }, 'm_empty_o' => sub { 'Y' =~ //o; }, }); #### c:\@Work\Perl\monks\belg4mit>perl cmp_qr_compilation_1.pl perl version 5.008009 Rate qr_interp qr_interp_o qr_bound m_empty m_empty_o qr_interp 2880477/s -- -9% -43% -55% -67% qr_interp_o 3181791/s 10% -- -37% -51% -64% qr_bound 5078627/s 76% 60% -- -21% -42% m_empty 6452035/s 124% 103% 27% -- -26% m_empty_o 8775008/s 205% 176% 73% 36% -- c:\@Work\Perl\monks\belg4mit>perl cmp_qr_compilation_1.pl perl version 5.014004 Rate qr_bound qr_interp m_empty m_empty_o qr_interp_o qr_bound 1004609/s -- -70% -76% -80% -92% qr_interp 3378700/s 236% -- -20% -33% -74% m_empty 4237856/s 322% 25% -- -16% -68% m_empty_o 5068698/s 405% 50% 20% -- -61% qr_interp_o 13135439/s 1208% 289% 210% 159% --