McA has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I couldn't find an answer to the follwing problem, so I hope that someone of you has some pointers.

I have a script which iterates over an array and does some functionality with every entry. The log shows that the performance per entry degrades very fast. With Devel-NYTProf I was able to identify the portion of code wasting most of the time. The problem was solved after some refactoring. What I couldn't identify was the fact that the performance degraded over time (in the solution before).

My question now is: Is there a way to see the profiling data written by Devel::NYTProf in a not aggregated but linear way, where I could see at which part of the program the timings get worse?

Regards
McA

Replies are listed 'Best First'.
Re: Linear Report with Devel-NYTProf
by hexcoder (Curate) on Jul 28, 2014 at 20:47 UTC
    I have not tried this out myself, but from the documentation of Devel-NYTProf it seems like the calls=N option might be worth to try. If your loop body is more or less a subroutine call, the following might be useful.

    From the documentation (emphasis done by me):

    calls=N

    This option is new and experimental.

    With calls=1 (the default) subroutine call return events are emitted into the data stream as they happen. With calls=2 subroutine call entry events are also emitted. With calls=0 no subroutine call events are produced. This option depends on the subs option being enabled, which it is by default.

    The nytprofcalls utility can be used to process this data. It too is new and experimental and so likely to change.

    The subroutine profiler normally gathers data in memory and outputs a summary when the profile data is being finalized, usually when the program has finished. The summary contains aggregate information for all the calls from one location to another, but the details of individual calls have been lost. The calls option enables the recording of individual call events and thus more detailed analysis and reporting of that data.