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: Gavin Smith
Subject: Re: Post release texi2any performance regression
Date: Sat, 4 Nov 2023 13:18:58 +0000

On Sat, Oct 28, 2023 at 05:42:51PM +0100, Gavin Smith wrote:
> I managed to disable a lot of the new XS code and get the test suite
> to pass.  I had to leave the XS translation module active due to the
> coupling that now exists between it and the XS parser.

This patch wasn't working any more so I updated it.  "make check" passes
with the patch below.

Applying this patch slows the program down by about 3% now.  However,
it could still be useful for investigating why development texi2any is
still significantly slower (about 5%) than texi2any 7.1.  It seems that
even if the new XS structuring/other modules speed the program up slightly,
there must be slowdown somewhere else.



diff --git a/tp/Texinfo/Common.pm b/tp/Texinfo/Common.pm
index 80cb1874ef..a19921f6cf 100644
--- a/tp/Texinfo/Common.pm
+++ b/tp/Texinfo/Common.pm
@@ -98,7 +98,7 @@ our %XS_overrides = (
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
-    if (!defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq '1') {
+    if (0) { # !defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq 
'1') {
       for my $sub (keys %XS_overrides) {
         Texinfo::XSLoader::override ($sub, $XS_overrides{$sub});
       }
diff --git a/tp/Texinfo/Convert/ConvertXS.pm b/tp/Texinfo/Convert/ConvertXS.pm
index 6ed1492359..d4ae8ebe0b 100644
--- a/tp/Texinfo/Convert/ConvertXS.pm
+++ b/tp/Texinfo/Convert/ConvertXS.pm
@@ -26,7 +26,8 @@ our $VERSION = '7.1dev';
 
 use Texinfo::XSLoader;
 
-BEGIN {
+#BEGIN {
+if (0) {
   Texinfo::XSLoader::init (
     "Texinfo::Convert::ConvertXS",
     "Texinfo::Convert::ConvertXS",
diff --git a/tp/Texinfo/Document.pm b/tp/Texinfo/Document.pm
index 0ef4129520..972ae58926 100644
--- a/tp/Texinfo/Document.pm
+++ b/tp/Texinfo/Document.pm
@@ -33,8 +33,7 @@ use Texinfo::StructTransf;
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
-    if (!defined $ENV{TEXINFO_XS_PARSER}
-        or $ENV{TEXINFO_XS_PARSER} eq '1') {
+    if (0) { # !defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq 
'1') {
       Texinfo::XSLoader::override(
         "Texinfo::Document::remove_document",
         # TODO add a Document XS .xs file and move to that file?
diff --git a/tp/Texinfo/StructTransf.pm b/tp/Texinfo/StructTransf.pm
index 24e8ded854..ff6c50f1c9 100644
--- a/tp/Texinfo/StructTransf.pm
+++ b/tp/Texinfo/StructTransf.pm
@@ -26,7 +26,8 @@ our $VERSION = '7.1dev';
 
 use Texinfo::XSLoader;
 
-BEGIN {
+#BEGIN {
+if (0) {
   Texinfo::XSLoader::init (
     "Texinfo::StructTransf",
     "Texinfo::StructTransf",
diff --git a/tp/Texinfo/Structuring.pm b/tp/Texinfo/Structuring.pm
index d21c4b67de..459374a7aa 100644
--- a/tp/Texinfo/Structuring.pm
+++ b/tp/Texinfo/Structuring.pm
@@ -124,8 +124,7 @@ our %XS_overrides = (
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
-    if (!defined $ENV{TEXINFO_XS_PARSER}
-        or $ENV{TEXINFO_XS_PARSER} ne '0') {
+    if (0) { # !defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} ne 
'0') {
       for my $sub (keys %XS_overrides) {
         Texinfo::XSLoader::override ($sub, $XS_overrides{$sub});
       }
diff --git a/tp/Texinfo/Transformations.pm b/tp/Texinfo/Transformations.pm
index 8bf237d2c8..7204d5b161 100644
--- a/tp/Texinfo/Transformations.pm
+++ b/tp/Texinfo/Transformations.pm
@@ -73,7 +73,7 @@ our %XS_overrides = (
 our $module_loaded = 0;
 sub import {
   if (!$module_loaded) {
-    if (!defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq '1') {
+    if (0) { #!defined $ENV{TEXINFO_XS_PARSER} or $ENV{TEXINFO_XS_PARSER} eq 
'1') {
       for my $sub (keys %XS_overrides) {
         Texinfo::XSLoader::override ($sub, $XS_overrides{$sub});
       }
diff --git a/tp/Texinfo/XS/parsetexi/Parsetexi.pm 
b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
index 1ced996e7a..94d1b7671c 100644
--- a/tp/Texinfo/XS/parsetexi/Parsetexi.pm
+++ b/tp/Texinfo/XS/parsetexi/Parsetexi.pm
@@ -190,6 +190,8 @@ sub _get_parser_info($$;$$) {
   my $no_build = shift;
   my $no_store = shift;
 
+  $no_build = 0;
+
   my ($registrar, $configuration_information)
      = _get_error_registrar($self);
 
diff --git a/tp/t/test_utils.pl b/tp/t/test_utils.pl
index f1fd7f9112..52ddd1eb76 100644
--- a/tp/t/test_utils.pl
+++ b/tp/t/test_utils.pl
@@ -1085,13 +1085,13 @@ sub test($$)
   # should not actually be useful, as the same element should be reused.
   $tree = $document->tree();
 
-  if ($with_XS) {
-    foreach my $error (@{$document->{'errors'}}) {
-      $registrar->add_formatted_message($error);
-    }
-    Texinfo::Structuring::clear_document_errors(
-                                           $document->document_descriptor());
-  }
+  # if ($with_XS) {
+  #   foreach my $error (@{$document->{'errors'}}) {
+  #     $registrar->add_formatted_message($error);
+  #   }
+  #   Texinfo::Structuring::clear_document_errors(
+  #                                          $document->document_descriptor());
+  # }
 
   my ($errors, $error_nrs) = $registrar->errors();
 
diff --git a/tp/texi2any.pl b/tp/texi2any.pl
index de51d7b96a..40ebe2e504 100755
--- a/tp/texi2any.pl
+++ b/tp/texi2any.pl
@@ -1636,15 +1636,15 @@ while(@input_files) {
     Texinfo::Structuring::number_floats($document);
   }
 
-  $document = Texinfo::Structuring::rebuild_document($document);
-
-  if ($with_XS) {
-    foreach my $error (@{$document->{'errors'}}) {
-      $registrar->add_formatted_message($error);
-    }
-    Texinfo::Structuring::clear_document_errors(
-                                        $document->document_descriptor());
-  }
+  # $document = Texinfo::Structuring::rebuild_document($document);
+
+  # if ($with_XS) {
+  #   foreach my $error (@{$document->{'errors'}}) {
+  #     $registrar->add_formatted_message($error);
+  #   }
+  #   Texinfo::Structuring::clear_document_errors(
+  #                                       $document->document_descriptor());
+  # }
 
   $error_count = handle_errors($registrar, $error_count, \@opened_files);
 




reply via email to

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