in reply to Re: Matching arrays?
in thread Matching arrays?
#!/usr/bin/perl use Benchmark qw(timethese cmpthese); my @seed = ("Hi there 11", "Fred blamed me", "17 o clock", "It's snowi +ng hampsters", "Pickles are people too!"); @text = map {@seed[$_ % $#seed+1]}(0 .. 300); cmpthese -1 => { short_circuit => 'grep(/11/||/are/,@text)', alternate => 'grep(/11|are/,@text)', } __END__ bagelbox:~ josh$ perl testgrep Rate alternate short_circuit alternate 642/s -- -81% short_circuit 3309/s 416% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Matching arrays?
by ysth (Canon) on Mar 09, 2004 at 04:31 UTC |