On Wed, Oct 25, 2023 at 10:12:48PM +0100, Gavin Smith wrote: > (Simply commenting out > > $document = Texinfo::Structuring::rebuild_document($document); > > improved run times dramatically, but gave incorrect output without > disabling the other XS code.)
In commit https://git.savannah.gnu.org/cgit/texinfo.git/commit/?id=7f1b750038f13a58bbd513a6f2f07dda5e87ad3f I have modified the code such that with XS the first document built out of the parser is a minimal document, without indices/tree, only information allowing following XS code to find C data, information on errors and some document information (adding novalidate and documentlanguage), as there is no perl code needing that information in the default XS case. The document/tree usable in perl is obtained by the Texinfo::Structuring::rebuild_document call. If you want to have full document built as before for the timing tests, you'll need to change the calls to parse_texi_file in texi2any.pl and the calls to parse_texi_text, parse_texi_piece and parse_texi_file in t/test_utils.pl, replacing the argument using $with_XS by something that is 0 if the intermediate perl data is to be kept. For example, if you add TEXINFO_XS_STRUCTURE, set to 1 in the default case, and set to 0 if the intermediate perl is to be run instead of XS, should be like: my $document = $parser->parse_texi_file($input_file_name, $with_XS and $TEXINFO_XS_STRUCTURE); -- Pat
