in reply to Count number of occurrence of word
use Benchmark(cmpthese); cmpthese(100_000, { 'a' => sub { $_ = 'this that this those this these.'; $a = () = /this/g; }, 'b' => sub { $_ = 'this that this those this these.'; $a++ while(s/this//); } });
wrong?Rate a b a 458716/s -- -7% b 492611/s 7% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Count number of occurrence of word
by Laurent_R (Canon) on Mar 09, 2014 at 18:47 UTC | |
by Lennotoecom (Pilgrim) on Mar 09, 2014 at 19:22 UTC | |
by Laurent_R (Canon) on Mar 09, 2014 at 20:06 UTC | |
by Lennotoecom (Pilgrim) on Mar 09, 2014 at 20:26 UTC | |
by karlgoethebier (Abbot) on Mar 10, 2014 at 17:19 UTC |