in reply to Finding bottlenecks in the code

Update: It was Filter::Indent::HereDoc which depends on Filter::Simple, which I believe depends on Text::Balanced. Took out F::I::H, re-indented all my HereDocs, and things fly. I am back in happy land, partially. I really do hate having to slide my HereDocs to the 0th column of the page instead of aligning neatly with the other prettily indented code. How do monks deal with this, if they do?

Thanks to BrowserUk's guidance, I got valuable mileage out of Devel::SmallProf. Fiddling around with various options, then going through the output, I have narrowed down the problem to Text::Balanced (see the top 8 worst perf hits below).

Text/Balanced.pm count wall tm cpu time line 47236 14.17731 13.93000 921: if (ref($func) eq 'CODE') 21983 7.933862 7.570000 952: if ($$textref =~ /\G(.)/gcs) 47236 1.307192 3.120000 918: $func = $func[$i]; 47236 1.252747 3.180000 930: if (defined($field) && length($field +)) 47236 1.168986 2.850000 919: $class = $class[$i]; 47236 1.068727 3.260000 920: $lastpos = pos $$textref; 47236 1.064919 3.290000 929: $pref ||= ""; 25253 1.048240 2.080000 915: foreach my $i ( 0..$#func )

Since I didn't directly call this module in use, obviously I am doing something that is calling its services. The modules I am using are --

I am also doing a bunch of regexp matching (does that call T::B?), but that seems to be very, very fast in the smallprof.out.

More guidance welcome. Where I am bringing in T::B? What can I do to avoid it, or to speed it.

Many thanks to everyone thus far.

--

when small people start casting long shadows, it is time to go to bed