Help for this page

Select Code to Download


  1. or download this
    Benchmark: timing 500000 iterations of chromatic, chromatic2, lookbehi
    +nd...
     chromatic: 18 wallclock secs (18.83 usr + 0.01 sys = 18.84 CPU) @ 265
    +43.50/s
    chromatic2: 13 wallclock secs (13.55 usr + 0.00 sys = 13.55 CPU) @ 369
    +00.37/s
    lookbehind: 14 wallclock secs (14.95 usr + 0.00 sys = 14.95 CPU) @ 334
    +42.58/s
    
  2. or download this
        use Benchmark;
        use vars qw/$a $b $c/;
    ...
            chromatic  => sub { local $_ = "foobarquux"; s/($c)$a/$1$b/g  
    +},
            chromatic2  => sub { local $_ = "foobarquux"; s/$c$a/$c$b/g  }
    +,
        });