-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repository size severely affects processing speed for ManagedReference templates due to RawModel sharing #23
Comments
Issue raised on the official docfx repository here - dotnet/docfx#10506. |
Would also like to add that the OE team has a nice explanation of the docfx templating system on the |
@glopesdev mentioned that he is trying to tackle this from another direction and avoid sharing all together @dotnet/docfx#5674 (comment). |
Another idea: We also might be able to trim down the input data with the |
Note: This technically isn't an existing issue yet, but will become an issue as we move forward with the ManagedRef templating system, especially for larger repositories like Bonsai.Core docs. @glopesdev encountered it while experimenting with the templates using the Bonsai.Core docs when the
docfx
local preview would not finish building, and I have also encountered it myself.Background
As part of our revamp of the API/References pages, we have been experimenting with the docfx templating system. Most of the time, we are using the templates to process the
docfx metadata
output files which are in the ManagedReference format. As such, I have taken to calling it theManagedReference templating system
to distinguish them from the usual HTML templating system.This is a quick rundown of the steps in this process based on this chart:
Metadata
- aManagedReference
file is generated for every eligible object (for instance, API classes). These are stored as.yml
files in the/api
folder and serve as theContent Source
for theBuild
step.Build
- theManagedReference
document processor generates aRawModel
for each object. This serves as the input data model for the next few steps.Pre-processing
- By setting theisShared
parameter inManagedReference.overwrite.js
totrue
in a custom template, everyRawModel
gets shared with all the otherRawModels
and is stored in the__global._shared
property of eachRawModel
.Pre-processing
Transform
- the template preprocessor transforms eachRawModel
into aViewModel
by performing some computation on the originalRawModel
and theRawModels
in the__global._shared
property.Renderer
step - the template renderer transforms eachViewModel
into the finalhtml
output.Problem
I believe the problem comes about in step 3, when the
RawModels
are being shared with each other. The resultingRawModel
size grows linearly and processing time grows exponentially with the number of objects. Step 3 is already being impacted, as it takes a long time to generate theseRawModels
, but I believe it also affects Step 4.Normally the
RawModels
are not exported, but you can use this command to inspect them. Without any additional arguments, theRawModels
get exported to_site/api/
asraw.json
files.dotnet docfx --exportRawModel
isShared
parameter inManagedReference.overwrite.js
is set to true, theRawModels
are huge.I tested it on the Bonsai.Core docs, the above command does run but takes 30 mins to complete (even with just the default templates). Each resulting
RawModel.raw.json
file is ~70MB and has >1.8 million lines.isShared
parameter inManagedReference.overwrite.js
is set to false, theRawModels
are much more manageable.With the Bonsai.Core docs, each resulting
RawModel.raw.json
file is <100kb and only has ~1000 lines.Solution
Unfortunately, in order to pull the information we want to customize the API pages with, it seems like we do need to share the
RawModels
with each other. I do not have a good solution for it yet, but if we want to continue with this approach it seems likewe should:
RawModel
file size.Additional context
#24 exacerbates this issue.
The text was updated successfully, but these errors were encountered: