in reply to What is faster?
You want to write a benchmarking script to test it..
*Untested, off the top of my head, code follows..
#!/usr/bin/perl use Benchmark; timethese(1000, { 'perl' => \&perl_grep, 'system' => \&system_grep, }); sub perl_grep{ open(OUTPUT, "$script | grep EXPRESSION |"); my @output = <OUTPUT>; } sub system_grep{ open(OUTPUT, "$script |"); my @output = <OUTPUT>; @output = grep { EPRESSION } @output; }
This will run each sub 1000 times and give you stats on their speed
cheers,
J
|
|---|