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


in reply to Needed Performance improvement in reading and fetching from a file

Hi,

I agree with smiffy. Even just splitting up to the fields you need, would not make that much difference, pushing to an array and later going again over it for printing is superfluous; if you really need to get it these way from another part of the program, you can also think of using an iterator/closure.
And again, are you really sure it's this section that is taking all the time? have you used Devel::DProf or Benchmark::Stopwatch?

Regards,

fmerges at irc.freenode.net
  • Comment on Re: Needed Performance improvement in reading and fetching from a file

Replies are listed 'Best First'.
Re^2: Needed Performance improvement in reading and fetching from a file
by harishnuti (Beadle) on Oct 08, 2008 at 07:23 UTC

    i do have other blocks in the program , but not really sure to how to find performance, so i suspected this splitting operation.
    infact . my requirement is little bit complex.
    Based on second field fetched, i will do some comparisions which then might need all fields which i use for CSV conversion(to csv file) in later part. so its wise to get second field only initially (using Optimized split as said above) and then if needed i will further split down later.
    i will try to see if other parts of program are really hitting peformance
      "but not really sure to how to find performance"

      It sounds like you would benefit from benchmarking/profiling your code. See Debugging and Optimization from the tutorials section of this site, also worth looking at is the Devel::NYTProf module, which I mention here.

      Hope this helps

      Martin

        Thanks, i will go through the link, really helpfull, i know the issue now, but trying to find solution, have updated my question