ChilliCream / ChilliCream/graphql-platform
Poor startup performance due to XML comment inference
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.8k
- Forks
- 810
- Avg merge
- 15h 39m
- Merged PRs (30d)
- 98
Description
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
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating XmlDocumentationProvider and profiling its XML-document traversal, especially the XPath navigation mentioned in the report. Compare startup with XML documentation enabled and disabled using the reported large schema; done means inference no longer causes a substantial startup-time penalty. The issue also raises whether XPathDocument would help, but does not specify a chosen approach.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100