Skip to content

Conversation

@filzrev
Copy link
Contributor

@filzrev filzrev commented Dec 14, 2024

This PR intended to optimize PDF generation performance.

On current implementation.

1 . PrintHeaderFooterCore method is called every page numbers. And it access physical every times.
2. When header/footer is specified as string. It process try-catch operation every times.

What's changed in this PR

  1. Add InvalidPathChars checks to detect pdfHeaderTemplate/pdfFooterTemplate is HTML content or not.
  2. Add headerFooterTemplateCache to reduce file I/O.
  3. Rename headerFooterCache to headerFooterPageCache

@codecov
Copy link

codecov bot commented Dec 14, 2024

Codecov Report

Attention: Patch coverage is 13.63636% with 19 lines in your changes missing coverage. Please review.

Project coverage is 79.35%. Comparing base (fe673ec) to head (80b6806).
Report is 498 commits behind head on main.

Files with missing lines Patch % Lines
src/Docfx.App/PdfBuilder.cs 13.63% 19 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10461      +/-   ##
==========================================
+ Coverage   74.31%   79.35%   +5.03%     
==========================================
  Files         536      547      +11     
  Lines       23189    23639     +450     
  Branches     4056     4062       +6     
==========================================
+ Hits        17234    18759    +1525     
+ Misses       4853     3710    -1143     
- Partials     1102     1170      +68     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Makes the pull request appear in "Performance" section of the next release note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants