Skip to content

Poor startup performance due to XML comment inference #8775

@N-Olbert

Description

@N-Olbert

Product

Hot Chocolate

Version

15.1.10

Link to minimal reproduction

Steps to reproduce

We have a huge schema (~8k fields, 30k lines with comments, 12k lines without)

Nearly every field is documented in detail and we also have lots of <see cref=""/> within the docs.

Currently, the startup of the service takes about 25 seconds.

A quick profiling showed that a significant amount of time is spent on infering the xml documentation from the code within the XmlDocumentationProvider

Image

Within this method, navigating through the document by XPath takes most of the time.

When disabling the XML doc inference (.ModifyOptions(static x => x.UseXmlDocumentation = !Debugger.IsAttached)), the start-up time is reduced drastically (~14 seconds).

What is expected?

Not a too big perf impact of XML comment inference (and maybe the feature should be disabled by default for dev environments).

What is actually happening?

Slow startup

Relevant log output

Additional context

I wonder whether it could be beneficial to use XPathDocument instead of XmlDocument there as the XPath navigation seems to be the bottleneck.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions