bug-texinfo
[Top][All Lists]
Advanced

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

Re: Texinfo 7.1 released


From: Gavin Smith
Subject: Re: Texinfo 7.1 released
Date: Sun, 22 Oct 2023 19:35:11 +0100

On Sun, Oct 22, 2023 at 09:06:39PM +0300, Eli Zaretskii wrote:
> > You could then disable modules with e.g.
> > 
> > mv ../tp/../tp/Texinfo/XS/XSParagraph.la{,.disable}
> > 
> > or
> > 
> > mv ../tp/../tp/Texinfo/XS/MiscXS.la{,.disable}
> 
> Thanks.  Looks like the slowdown is in XSParagraph: without it, I get
> 21.8 sec, only slightly slower than Texinfo 7.0.3.  Disabling MiscXS
> as well yields almost the same time (0.05 sec longer) as with MiscXS,
> and disabling Parsetexi gets us back to 37 sec, the same as with
> TEXINFO_XS=omit.

One thing to try would to eliminate dTHX calls.  If these are
time-consuming on MinGW/MS-Windows, then extra calls will greatly slow
down the program, due to the number of times the paragraph formatting
functions are called.

This patch, applied to 7.1, removes the recently added dTHX calls,
but also removes the fprintf calls that were preventing compilation
without it:

diff xspara.c{.old,} -u
--- xspara.c.old        2023-10-22 19:19:59.805018584 +0100
+++ xspara.c    2023-10-22 19:25:44.048344033 +0100
@@ -565,8 +565,6 @@
 void
 xspara__add_pending_word (TEXT *result, int add_spaces)
 {
-  dTHX;
-
   if (state.word.end == 0 && !state.invisible_pending_word && !add_spaces)
     return;
 
@@ -599,10 +597,6 @@
 
       state.counter += state.space_counter;
 
-      if (debug)
-        fprintf (stderr, "ADD_SPACES(%d+%d)\n", state.counter,
-                                                state.word_counter);
-
       state.space.end = 0;
       state.space_counter = 0;
     }
@@ -643,14 +637,9 @@
 {
   static TEXT ret;
 
-  dTHX;
-
   text_reset (&ret);
   state.end_line_count = 0;
 
-  if (debug)
-    fprintf (stderr, "PARA END\n");
-
   /* probably not really useful, but cleaner */
   state.last_letter = L'\0';
 
@@ -691,8 +680,6 @@
 void
 xspara__add_next (TEXT *result, char *word, int word_len, int transparent)
 {
-  dTHX;
-
   int disinhibit = 0;
   if (!word)
     return;
@@ -803,9 +790,6 @@
           xspara__cut_line (result);
         }
     }
-  if (debug)
-    fprintf (stderr, "WORD+ %s -> %s\n", word, state.word.space == 0 ?
-                "UNDEF" : state.word.text);
 }
 
 /* Like _add_next but zero end_line_count at beginning. */


dTHX is discussed in the manual ("man perlguts") as being less efficient
than another way of getting the Perl context (using pTHX or pTHX_), so
its execution time can evidently be significant.

I have looked for other differences in xspara.c between Texinfo 7.0.3
and Texinfo 7.1 and cannot really see anything suspicious.  The only
other thing that comes to mind that there could have been a change
in imported gnulib modules.

Failing that, the only I idea I have is to use some kind of source-level
profiler to find out why so much time is spent in this module.



reply via email to

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