On Sun, Feb 12, 2023 at 11:38:43AM +0000, Gavin Smith wrote:
> I'll try to look at this commit more to see if I can find anything else.

It's good news: we can keep the uninlined function.  The slowdown almost
goes away completely if we eliminate the use of goto statements, e.g.:

diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 81ca96b3b6..b4765549ef 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -3921,7 +3921,7 @@ sub _process_remaining_on_line($$$$)
                                         'extra' => {'arg_line' => $line }};
       $current = $current->{'contents'}->[-1];
       $retval = $GET_A_NEW_LINE;
-      goto funexit;
+      return ($current, $line, $source_info, $retval);
     } elsif ($line =~ /^(\s*?)\@end\s+([a-zA-Z][\w-]*)/
              and ($2 eq $current->{'cmdname'})) {
       if ($line =~ s/^(\s+)//) {

Making this change throughout _process_remaining_on_line reduces the
run time for the manual in question from 45.6 s to 26.8 s.

This is with perl 5.30.0.

> I suspect it may just be that Perl subroutine calls are very slow, so it
> is faster to inline everything into one long subroutine that is thousands
> of lines long.

This is true to some extent, but wasn't the main cause of the longer
runtimes on this occasion.


Reply via email to