in reply to Re: Benchmarking File Retrevial
in thread Benchmarking File Retrevial
Reinitializing @hitwords is a good idea. I'll try it. Also, I thought the only difference between while($word = <WORDS>){ and while(<WORDS>){ was that in the latter, the line was stored in !_. I haven't been able to find any documentation to the contrary, although I'd believe there might be a difference.use Benchmark qw/countit cmpthese/; sub run($) { countit(5, @_) } for $size (2, 200, 20_000) { $s = "." x $len; print "\nDATASIZE = $size\n"; cmpthese { chop2 => run q{ $t = $s; chop $t; chop $t; }, subs => run q{ ($t = $s) =~ s/..\Z//s; }, lsubstr => run q{ $t = $s; substr($t, -2) = ''; }, rsubstr => run q{ $t = substr($s, 0, length($s)-2); }, }; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Benchmarking File Retrevial
by chromatic (Archbishop) on Dec 15, 2002 at 23:51 UTC | |
|
Re: Re: Re: Benchmarking File Retrevial
by demerphq (Chancellor) on Dec 16, 2002 at 00:06 UTC |