Re: performance of parsing docbook with xincludes

Nick Wellnhofer <[email protected]> Tue, 15 May 2018 12:42:44 +0200
Newsgroups gmane.comp.gnome.lib.xml.general
Message-ID <[email protected]>
On 14/05/2018 21:48, Stefan Sauer wrote:
> This part looks suspicious:
> 
>                 |--22.98%--0xc2160
>                 |          xmlFreeDoc
>                 |          |
>                 |           --22.42%--xmlFreeDtd

> Can I tell it to not load dtds in the first place? Is it loading the dtd for each an every xinclude?

Good catch. It seems that the XInclude engine always parses included docs with 
XML_PARSE_DTDLOAD:

     https://git.gnome.org/browse/libxml2/tree/xinclude.c#n450

If you're not using XML catalogs, this will probably cause the DTD to be 
loaded over the network multiple times which could explain the slowdown.

Can you try to change the line to

     xmlCtxtUseOptions(pctxt, ctxt->parseFlags);

and see if it helps?

Nick