On Sun, Oct 06, 2024 at 12:09:47PM +0100, Gavin Smith wrote: > On Sun, Oct 06, 2024 at 09:53:22AM +0200, Patrice Dumas wrote: > > > How much slower would the linear search actually be? > > > > It is much slower (if I recall well, it was something like 100 times > > slower for the texi2any manual). I juste tested the overall effect and > > for the pure C demonstrator for the Texinfo manual, time is about 0.375 > > s with linear search and 0.305 with the hash map. > > That is a 20% decrease which is significant, but is only 0.07 sec > absolute difference in run time. > > Does it scale with the size of the input? Perhaps a certain part of > this 0.07 sec is fixed regardless of the size of the input file. Have > you tried it with a larger manual like glibc or elisp?
I've tried it myself although have been unable to run it on anything but texinfo.texi for the manuals I tried. I did not see anything in teximakehtml.c about which converter was used so I patched the code in converter_converter in converter/converter.c which passed the CONVF_cxx_hashmap or CONVF_string_list argument to new_converter. (Is the "string list" implementation really used by default by texi2any as it doesn't look that way from the code?) /* NOTE if HAVE_CXX_HASHMAP is not set, even with CONVF_cxx_hashmap string lists will be used */ size_t converter_descriptor = new_converter (format, CONVF_cxx_hashmap); /* To use a string list. Slower. size_t converter_descriptor = new_converter (format, CONVF_string_list); */ Times are in seconds. manual C++ hash string list texinfo 0.39 0.45 libc.texi - unable to run test due to numerous error messages that don't occur with texi2any: $ time ../../../../tp/texi2any.pl --html ../../../../../libc/libc.texinfo real 0m11.077s user 0m10.586s sys 0m0.396s 0$ time TEXINFO_XS_CONVERT=1 ../../../../tp/texi2any.pl --html ../../../../../libc/libc.texinfo real 0m2.417s user 0m2.116s sys 0m0.300s $ time ../teximakehtml ../../../../../libc/libc.texinfo charset.texi:2074: unknown command `cal' charset.texi:2074: unknown command `cal' charset.texi:2075: unknown command `cal' charset.texi:2075: unknown command `cal' charset.texi:2076: unknown command `cal' charset.texi:2076: unknown command `cal' charset.texi:2081: unknown command `cal' charset.texi:2081: unknown command `cal' charset.texi:2084: unknown command `cal' charset.texi:2084: unknown command `cal' charset.texi:2094: unknown command `cal' charset.texi:2098: unknown command `cal' charset.texi:2098: unknown command `cal' charset.texi:2105: unknown command `cal' charset.texi:2105: unknown command `cal' charset.texi:2109: unknown command `cal' charset.texi:2118: unknown command `cal' charset.texi:2119: unknown command `cal' charset.texi:2161: unknown command `cal' charset.texi:2161: unknown command `cal' charset.texi:2162: unknown command `cal' charset.texi:2162: unknown command `cal' charset.texi:2163: unknown command `cal' charset.texi:2163: unknown command `cal' socket.texi:3384: unknown command `hfuzz' math.texi:568: unknown command `infty' (possibly involving @infinity) math.texi:569: unknown command `infty' (possibly involving @infinity) math.texi:1231: unknown command `infty' (possibly involving @infinity) math.texi:1249: unknown command `infty' (possibly involving @infinity) math.texi:1267: unknown command `infty' (possibly involving @infinity) math.texi:1281: unknown command `cdot' (possibly involving @mul) ... elisp.texi - also unable to run test. See output below: 0$ time ../../../../tp/texi2any.pl --html ../../../../../emacs-lispref-27.2/elisp.texi functions.texi:2390: warning: @inforef is obsolete errors.texi:226: warning: unexpected argument on @ignore line: The following seem to be unused now. real 0m10.437s user 0m10.124s sys 0m0.304s 0$ time TEXINFO_XS_CONVERT=1 ../../../../tp/texi2any.pl --html ../../../../../emacs-lispref-27.2/elisp.texi functions.texi:2390: warning: @inforef is obsolete errors.texi:226: warning: unexpected argument on @ignore line: The following seem to be unused now. real 0m2.399s user 0m2.138s sys 0m0.260s 0$ time ../teximakehtml ../../../../../emacs-lispref-27.2/elisp.texi intro.texi:37: warning: undefined flag: VERSION functions.texi:2390: warning: @inforef is obsolete files.texi:3244: unknown command `discretionary' files.texi:3244: misplaced { files.texi:3244: misplaced { files.texi:3244: misplaced } files.texi:3244: misplaced { files.texi:3244: misplaced } files.texi:3244: misplaced } files.texi:3250: unknown command `discretionary' files.texi:3250: misplaced { files.texi:3250: misplaced { files.texi:3250: misplaced } files.texi:3250: misplaced { files.texi:3250: misplaced } files.texi:3250: misplaced } files.texi:3253: unknown command `discretionary' files.texi:3253: misplaced { ... There are also error messages about locales and collation: $ ../teximakehtml ../../../../doc/texinfo.texi BUG: no Perl collation texi2any: warning: collation locale not found: en_US