http://www.perlmonks.org?node_id=61543


in reply to Re: Assining data to an array is slow..
in thread Assining data to an array is slow..

Doesn't getting the warning "too few iterations for a reliable count" in the output bother you at all?

--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

  • Comment on Re: Re: Assigning data to an array is slow..

Replies are listed 'Best First'.
Re: Re: Re: Assining data to an array is slow..
by rbi (Monk) on Mar 01, 2001 at 17:41 UTC
    hi davorg,
    sure that warning it's not very nice... :) however I also saw similar difference (about 15%) by running separately the routines and checking with the ps - process status - command.
    As I said, I've tried to use Benchmark for the first time (there's always a first time...) for this test. However, I guess it's not a problem of file size that warning. I'd appreciate, for my learning, if the code would be changed by someone to something that can be bechmarked (if it is not a problem of input file size).
    ciao
    Roberto

      The problem isn't in the size of the file that you're processing, but rather in the number of times you run the test. You don't show the code that sets your $count variable, but you should look at increasing that value.

      --
      <http://www.dave.org.uk>

      "Perl makes the fun jobs fun
      and the boring jobs bearable" - me

        The benchmark result is confirmed for better performance of substr in the test above.
        I've put $count = 100 and reduced the input file size. Now I don't get any warning, the improvement with method Three is evaluated to be about 25%:
        Benchmark: timing 100 iterations of Method One, Method Three, Method T +wo... Method One: 7 wallclock secs ( 7.60 usr + 0.11 sys = 7.71 CPU) Method Two: 8 wallclock secs ( 7.83 usr + 0.11 sys = 7.94 CPU) Method Three: 6 wallclock secs ( 5.82 usr + 0.10 sys = 5.92 CPU)
        About the benchmark... I felt more confortable with about 40 CPU seconds, even if there was a warning. With repeated iterations I think some time is taken by the call, while one call with a big file is better focussing on the array extraction. But it is just my feeling... :) I'd better study the Benchmark routines to evaluate this
        ciao
        Roberto