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

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

Recently I took a look through the TODO list with 5.12.1, to see if there was anything that I felt up to attempting, when I found the item 'profile installman'.

perltodo says, "The installman script is slow. All it is doing text processing, which we're told is something Perl is good at. So it would be nice to know what it is doing that is taking so much CPU, and where possible address it." So I installed a few modules, watched a presentation or two about them, ran installman with Devel::NYTProf, and got the following results:

Profile of installman for 499s (of 802s), executing 43948889 statements and 11014444 subroutine calls in 56 source files and 15 string evals.
Top 15 Subroutines Calls P F Exclusive Time Inclusive Time Subroutine
279321151.6s443sPod::Simple::BlackBox::::parse_lines
290761254145.4s45.5sPod::Man::::CORE:subst (opcode)
1533411128.5s55.6sPod::Man::::guesswork
1107585126.2s380sPod::Simple::BlackBox::::_ponder_paragraph_buffer
2115511123.4s85.9sPod::Man::::format_text
835441122.2s30.4sPod::Simple::BlackBox::::_treelet_from_formatting_codes
7511120.9s474sPod::Simple::::parse_file
1662783118.4s101sPod::Man::::_handle_element_end
1612542118.2s242sPod::Simple::BlackBox::::_traverse_treelet_bit (recurses: max depth 2, inclusive time 49.4s)
217384113117.3s17.5sPod::Simple::BlackBox::::CORE:match (opcode)
1662783116.7s31.6sPod::Man::::_handle_element_start
835441111.5s91.1sPod::Simple::::_make_treelet
551544119.43s9.43sPod::Simple::::CORE:readline (opcode)
83544119.40s9.40sPod::Simple::::_remap_sequences
33447119.21s9.81sPod::Simple::::_wrap_up

Now I am afraid I am a bit confused, or, at least, feeling outside my depth. Looking at the details on those calls, it seems as almost all of those top 15 were taking tenths of a second a most per run, but the sheer number of calls resulting in the lengthy processing time. Am I reading this right, or ignoring something obvious?

(As always, the time and feedback are appreciated.)

Update: 2011-02-23

Added "per run" to clarify my thought on the times the routines were taking per run.

Update: 2011-02-23

The average run time for the functions above are as follows:

Calls Inclusive time Average time per call Subroutine
27932443s15.9msPod::Simple::BlackBox::parse_lines
290761245.5s16µsPod::Man::CORE:subst
15334155.6s363µsPod::Man::guesswork
110758380s3.43msPod::Simple::BlackBox::_ponder_paragraph_buffer
21155185.9s406µsPod::Man::format_text
8354430.4s364µsPod::Simple::BlackBox::_treelet_from_formatting_codes
751474s631msPod::Simple::parse_file
166278101s608µsPod::Man::_handle_element_end
161254242s1.50msPod::Simple::BlackBox::_traverse_treelet_bit
217384117.5s8µsPod::Simple::BlackBox::CORE:match
16627831.6190µsPod::Man::_handle_element_start
8354491.1s1.09msPod::Simple::_make_treelet
5515449.43s17µsPod::Simple::CORE:readline
835449.40s113µsPod::Simple::_remap_sequences
334479.81s293µsPod::Simple::_wrap_up

Update: 2011-02-25

Fixed typo in table.