Help for this page

Select Code to Download


  1. or download this
      find the first occurrence of '<IPDR>'      # fast
      walk the string to the '</IPDR>'           # fastish
      skip back to the last occurrence of 'test' # fast
      walk forward to the '</IPDR>' again        # fastish
      signal success                             # done
    
  2. or download this
      find the first occurrence of '<IPDR>'      # fast
      walk the string to the end                 # fastish
    ...
      repeat last two steps for each additional occurrence of 'test'
        # slow - quadratic in the number of occurrences of 'test'
      (no more 'test's to try) signal failure    # done
    
  3. or download this
    use strict;
    use Benchmark qw/ cmpthese timethese /;
    ...
        }
    }
    timethese(-1, $trial);
    
  4. or download this
       uncut1g:   12799.05/s
         cut1g:   12799.05/s
    ...
      cut1000g:     956.48/s
    uncut1000b:       1.85/s
      cut1000b:     532.38/s