dotnet / dotnet/docfx

Performance issues on big C# solutions/projects

Open
#1,925 20 comments 0 reactions 0 assignees View on GitHub
fundamental: performance
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 11m
Merged PRs (30d)
10

Description

**DocFX Version Used**: docfx 2.22.0.0

**Template used**: `default`

**Steps to Reproduce**:

1. Add docfx.console to large project
2. Build

**Expected Behavior**: _site to be generated within reasonable time

**Actual Behavior**: it takes hours to build

I have a solution with 108 projects. I am trying docfx to build a documentation.
For entire solution it just dies.
For one of the largest projects (~20K yml files) it takes ~2 hours to build.
Yesterday I have tried to build 8 most important projects at once.
It has run for more that 25 hours. I have killed the process.
When running manually `docfx --serve` for the same 8 projects it shows:

`Info:[MetadataCommand]Completed Scope:MetadataCommand in 1079297,1584 milliseconds.`

`...`

`Info:[BuildCommand.Build Document.LinkPhaseHandlerWithIncremental.UpdateContext]2 external references found in 1 xref maps.`

Similar entries were found in the `log.txt` created when building from studio.
After that last entry it just hangs. It eats memory (more than 20GB eaten), and it constantly loads my SSD. For that 25h run it has read more than 500GB as per ProcessExplorer stats.

Is there any way to fix the problem?
Can I build solution docs incrementally (project-by-project) so that links/refs will work?

Default built docfx.json was used with the following change:

"metadata": [
{
"src": [
{ "files": ["*.csproj"],
"cwd": ".",
"exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../Shared/BlToolkit/Source", "exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../Shared/SharedTypes", "exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../Shared/ImportantSharedTypes", "exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../MyXComponents/Important.OperationTypes", "exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../MyXComponents/MyXHost", "exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../MyXComponents/MyDefs", "exclude": ["**/obj/**","**/bin/**","_site/**"] }
,{files: ["*.csproj"], "cwd": "../../../MyXComponents/MyCXC", "exclude": ["**/obj/**","**/bin/**","_site/**"] }

],
"dest": "obj/api"
}
],

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.