package My::Filter; use Filter::Simple; use Benchmark::Timer; our $t = Benchmark::Timer->new(); FILTER_ONLY regex => sub { $_ = "(?{{ \$My::Filter::t->start('$_') }})" . "(?:$_)" . "(?{{ \$My::Filter::t->stop('$_') }})"; }, ; sub report{ return $t->report() } 1; #### #! perl -slw use strict; use My::Filter; #<< Include the module my $stuff = 'abcdefghijklmnopqrstuvwxyz'; for (1..1000) { if ( $stuff =~ m[pqr] ) { $stuff =~ s/(\G(?:.{3})+?)(?<=...)(.)(.)/$1$3$2/g; } $_ = $stuff; my $OK = 1 if m[pqr]; } print $stuff; print '=' x 20, 'Timing of regexs in ', $0, '=' x 20; print My::Filter::report(); # << Generate report #### C:\test>test abcdefghijklmnopqrstuvwxyz ====================Timing of regexs in C:\test\test.pl==================== 2000 trials of pqr (290.000ms total), 145us/trial 5000 trials of (\G(?:.{3})+?)(?<=...)(.)(.) (820.000ms total), 164us/trial