Mandor has asked for the wisdom of the Perl Monks concerning the following question:
Now, watch. First line:$tree -> parse_file ($file); # $tree is a XML::TreeBuilder my @results = $tree -> look_down ('attr' => 'value');
Second line:timethis (5000, sub {$tree -> parse_file ($file)}); timethis 5000: 16 wallclock secs (12.98 usr + 1.41 sys = 14.39 CPU) @ + 347.46/s (n=5000)
First and second line:timethis (5000, sub {my @results = $tree -> look_down('attr' => 'value +')}); timethis 5000: 2 wallclock secs ( 1.42 usr + 0.00 sys = 1.42 CPU) @ + 3516.17/s (n=5000)
Shouldn't the total speed be something over 300? Am I missing something fundamental? Any ideas?timethis (500, sub {$tree -> parse_file ($file); my @results = $tree - +> look_down('attr'=> 'value')}); timethis 500: 36 wallclock secs (34.32 usr + 0.19 sys = 34.51 CPU) @ +14.49/s (n=500)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::TreeBuilder strange benchmarking behaviour
by BrowserUk (Patriarch) on Jul 15, 2003 at 14:30 UTC |