Merged
Conversation
The scorecard and summary templates include header.tex, which is responsible for adding the logo above the document title. It's not related to the logo inserted into the page headers. Rename the file to make this clearer.
Both a width and height is specified when inserting the logo above the title, changing the aspect ratio and leading to noticeable distortion. Avoid this by specifying only the width. Increase the width a bit to push the height a little closer to what it was before this change. (A width of 3.6 cm would be needed to maintain a height of 2 cm.)
Rendering scorecards on Metworx 25-02.00.00 has become slower compared
to rendering on Metworx 24-04.03.01 (e.g., rendering nmrec's scorecard
has gone from around 6 seconds to around 11 seconds).
The primary slowdown comes from the xelatex call. In particular,
inserting the page header logo appears slower. Perhaps this is due to
a change in XeLaTex (TeX Live 2023 versus Tex Live 2024) or an
underlying library (e.g., libpng).
The slowdown can be triggered by feeding xelatex a minimal tex file
(with only the fancyhdr setup and blank sections, for a total of 8
headers/pages) and can be decreased by using a smaller image (100x55
versus 2541x1401). Here are timings (via hyperfine):
25-02.00.00
Benchmark 1: xelatex logobig
Time (mean ± σ): 3.625 s ± 0.008 s [User: 3.409 s, System: 0.233 s]
Range (min … max): 3.612 s … 3.644 s 10 runs
Benchmark 2: xelatex logosmall
Time (mean ± σ): 662.7 ms ± 7.2 ms [User: 575.2 ms, System: 105.6 ms]
Range (min … max): 656.3 ms … 681.5 ms 10 runs
Summary
'xelatex logosmall' ran
5.47 ± 0.06 times faster than 'xelatex logobig'
24-04.03.01
Benchmark 1: xelatex logobig
Time (mean ± σ): 952.2 ms ± 8.5 ms [User: 835.9 ms, System: 133.4 ms]
Range (min … max): 944.6 ms … 974.9 ms 10 runs
Benchmark 2: xelatex logosmall
Time (mean ± σ): 566.4 ms ± 5.5 ms [User: 471.8 ms, System: 111.8 ms]
Range (min … max): 560.7 ms … 574.6 ms 10 runs
Summary
'xelatex logosmall' ran
1.68 ± 0.02 times faster than 'xelatex logobig'
Notably the ~5x slowdown on 25-02 increases with the number of pages
and doesn't happen under pdflatex.
Switch to the smaller image to decrease the 25-02 render times. There
should be no downside to doing so because 100x55 is sufficient
resolution for the small logo inserted into the header.
seth127
approved these changes
Jun 5, 2025
Collaborator
seth127
left a comment
There was a problem hiding this comment.
This looks good to me @kyleam . Thanks for making this change, and I'm glad it helped the slowdown. Also, the squished aspect ratio on the top logo had been bothering me, so it's nice that it's fixed too.
@barrettk no need to give this an official review, but please read through the PR description for awareness. Thanks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR proposes two logo-related tweaks:
change the
includegraphicscall for the title logo to avoid changing the logo's aspect ratioadd a smaller logo image and use it in the page headers in order speed up rendering. This is particularly relevant for Metworx 25-02, where rendering has a substantial slowdown that, at least largely, looks to be the result of the slower header logo insertion under
xelatex.Screenshots
Title logo
pre
post
Header logo
pre
post
Timings
Rendering a subset of scorecards
Summary
render time in seconds, pre (release, 54c48d4) and post (tip of this PR)
Detailed output, including
rmarkdown:::perf_timer_summary()output, elapsed time for each package, and total elapsed time:pre, 24-04.03.01
R 4.3.1, pandoc 3.1.8
pre, 25-02.00.00
R 4.4.2, pandoc 3.3
post, 24-04.03.01
R 4.3.1, pandoc 3.1.8:
post, 25-02.00.00
R 4.4.2, pandoc 3.3
Calling xelatex with minimal input
Here's the minimal tex file used for the hyperfine timings included in the last commit: