bug-texinfo
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Post release texi2any performance regression


From: Patrice Dumas
Subject: Re: Post release texi2any performance regression
Date: Sun, 5 Nov 2023 13:01:21 +0100

On Sat, Nov 04, 2023 at 11:18:59PM +0000, Gavin Smith wrote:
> After comparing results from NYTProf for Texinfo 7.1 and the master
> branch with the patch I posted, the remaining possibility that I suspect,
> but which I haven't been able to investigate yet due to being stymied
> by other problems, is the code dealing with "untranslated" strings
> in Plaintext.pm:
> 
>     } else {
>       my $tree;
>       if ($element->{'extra'}
>           and $element->{'extra'}->{'translation_context'}) {
>         $tree = $self->pgdt($element->{'extra'}->{'translation_context'},
>                             $element->{'text'});
>       } else {
>         $tree = $self->gdt($element->{'text'});
>       }
>       my $converted = _convert($self, $tree);
>       return $converted;
>     }
> 
> For the manual I was testing (Emacs Lisp manual), _convert was not
> run at all with the 7.1 release, but was run 2519 times with the master
> branch with the patch.  I could see this early by NYTProf's caller
> information for _convert:
> 
> 7.1:
> 
> #   2871 times (56.0ms+-56.0ms) by Texinfo::Convert::Plaintext::_convert at 
> line 3387, avg 0s/call
> #   2007 times (19.5ms+-19.5ms) by Texinfo::Convert::Plaintext::_convert at 
> line 2154, avg 0s/call
> 
> Patched master:
> 
> #   2871 times (53.9ms+-53.9ms) by Texinfo::Convert::Plaintext::_convert at 
> line 3393, avg 0s/call
> #   2519 times (43.4ms+-43.4ms) by Texinfo::Convert::Plaintext::_convert at 
> line 1859, avg 0s/call
> #   2007 times (30.9ms+-30.9ms) by Texinfo::Convert::Plaintext::_convert at 
> line 2163, avg 0s/call
> 
> It is comparable due to the same number of calls at different sites, and the
> extra call site is easy to spot.
> 
> Indeed, commenting out those lines of code (although it makes the output
> incorrect) appeared to restore the run time to that of 7.1.
> 
> This may have been due to a fairly recent change, but the lack of a
> stable, satisfactory reference point ever since the 7.1 release makes
> this much, much more time-consuming to investigate.  While one problem is
> fixed, another may be inadvertently introduced.

It is completely unrelated to the major changes going on, but related to
the recent change of setting untranslated even if no @documentlanguage
have been seen  at the time the @-command appears.  The change can be
reverted, or something more complex can be done, such as removing the
untranslated later on if no @documentlanguage is seen afterwards, or
maybe in Plaintext.pm, not calling gdt/pgdt if documentlanguage is not
set.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]