Skip to content

🚀 [Feature]: Install-GoogleFont is faster on repeats and bulk installs - #210

Merged
Marius Storhaug (MariusStorhaug) merged 30 commits into
mainfrom
perf/install-improvements
May 18, 2026
Merged

🚀 [Feature]: Install-GoogleFont is faster on repeats and bulk installs#210
Marius Storhaug (MariusStorhaug) merged 30 commits into
mainfrom
perf/install-improvements

Conversation

@MariusStorhaug

@MariusStorhaugMarius Storhaug (MariusStorhaug) commented May 17, 2026

Copy link
Copy Markdown
Member

Install-GoogleFont now finishes repeated runs and large batches significantly faster by skipping already-installed fonts, deduplicating overlapping selections, reusing cached download files, and increasing download concurrency to match available processor capacity by default.

Changed: Repeated installs skip unnecessary work

When -Force is not used, rows that are already installed at the selected scope are skipped before download and install work starts, so reruns avoid network and disk overhead while still reporting skip reasons through verbose output.

Changed: Bulk and wildcard selections process each font file once

Selections are resolved and deduplicated by URL before processing, which prevents duplicate download/install work from overlapping wildcard patterns and repeated names in the same invocation.

Changed: Download throughput scales with host capacity

The download phase now uses parallel work with a default throttle based on Environment::ProcessorCount, so larger hosts use more available network and CPU capacity without requiring callers to change existing command usage.

Changed: Download cache reuse cuts repeat transfer cost

Downloaded font assets are reused when the same URL is requested again and -Force is not used, reducing repeated CDN requests across retries and reruns.

Fixed: Download progress rendering no longer slows bulk runs

Progress rendering is suppressed during web requests and restored afterward, keeping transfer-heavy runs faster while preserving normal progress behavior outside the function scope.

Technical Details

CopilotAI review requested due to automatic review settings May 17, 2026 12:42
@MariusStorhaugMarius Storhaug (MariusStorhaug) added the Prerelease Make a prerelease of the package/module/repo. label May 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

PatternDescription
^src/Matches files where path matches this pattern
^README\.md$Matches files where path matches this pattern

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a small PowerShell 7+ benchmarking harness for measuring Install-GoogleFont performance iterations, and prevents the generated perf output from being committed.

Changes:

  • Add scripts/Measure-InstallPerformance.ps1 to run repeatable install/uninstall scenarios and append JSONL timing results.
  • Ignore the default output file scripts/perf-results.jsonl in .gitignore.

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

FileDescription
scripts/Measure-InstallPerformance.ps1New perf measurement script that runs install scenarios and logs duration/results to JSONL.
.gitignoreIgnores the generated scripts/perf-results.jsonl output file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadscripts/Measure-InstallPerformance.ps1 Outdated
Comment threadscripts/Measure-InstallPerformance.ps1 Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Measure-In 16 The cmdlet 'I
stallPerfo nvoke-Uninsta
rmance.ps1 ll' does not
have a help c
omment.
PSProvideCommentHelp Information Measure-In 26 The cmdlet 'M
stallPerfo easure-Scenar
rmance.ps1 io' does not
have a help c
omment.

@github-actions

Copy link
Copy Markdown
Contributor

✅ New prerelease: PowerShell Gallery - GoogleFonts 1.0.129-perfinstallimprovements001

@github-actions

Copy link
Copy Markdown
Contributor

✅ New prerelease: GitHub - GoogleFonts v1.0.129-perfinstallimprovements001

@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Measure-In 16 The cmdlet 'I
stallPerfo nvoke-Uninsta
rmance.ps1 ll' does not
have a help c
omment.
PSProvideCommentHelp Information Measure-In 26 The cmdlet 'M
stallPerfo easure-Scenar
rmance.ps1 io' does not
have a help c
omment.

@github-actions

Copy link
Copy Markdown
Contributor

✅ New prerelease: PowerShell Gallery - GoogleFonts 1.0.129-perfinstallimprovements002

@github-actions

Copy link
Copy Markdown
Contributor

✅ New prerelease: GitHub - GoogleFonts v1.0.129-perfinstallimprovements002

CopilotAI review requested due to automatic review settings May 17, 2026 12:54
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Measure-In 16 The cmdlet 'I
stallPerfo nvoke-Uninsta
rmance.ps1 ll' does not
have a help c
omment.
PSProvideCommentHelp Information Measure-In 26 The cmdlet 'M
stallPerfo easure-Scenar
rmance.ps1 io' does not
have a help c
omment.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 4 comments.

Comments suppressed due to low confidence (1)

src/functions/public/Install-GoogleFont.ps1:160

  • Restoring $ProgressPreference is currently dependent on the clean block completing successfully after Remove-Item. If Remove-Item -Path $tempPath throws, $ProgressPreference may not be restored to the caller’s value. Consider restoring it unconditionally (and ideally before filesystem cleanup), or wrap cleanup in a try/finally so preference restoration is guaranteed.
 clean {
Remove-Item -Path $tempPath -Force
if ($previousProgressPreference) {
$ProgressPreference = $previousProgressPreference
}

Comment threadsrc/functions/public/Install-GoogleFont.ps1
Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
Comment threadsrc/functions/public/Install-GoogleFont.ps1
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Measure-In 16 The cmdlet 'I
stallPerfo nvoke-Uninsta
rmance.ps1 ll' does not
have a help c
omment.
PSProvideCommentHelp Information Measure-In 26 The cmdlet 'M
stallPerfo easure-Scenar
rmance.ps1 io' does not
have a help c
omment.

CopilotAI review requested due to automatic review settings May 17, 2026 13:03
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Measure-In 16 The cmdlet 'I
stallPerfo nvoke-Uninsta
rmance.ps1 ll' does not
have a help c
omment.
PSProvideCommentHelp Information Measure-In 26 The cmdlet 'M
stallPerfo easure-Scenar
rmance.ps1 io' does not
have a help c
omment.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated 5 comments.

Comment threadsrc/functions/public/Install-GoogleFont.ps1
Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
Comment threadtests/GoogleFonts.Tests.ps1 Outdated
Comment threadsrc/functions/public/Install-GoogleFont.ps1
@github-actions

Copy link
Copy Markdown
Contributor

✅ New prerelease: PowerShell Gallery - GoogleFonts 1.0.129-perfinstallimprovements003

@github-actions

Copy link
Copy Markdown
Contributor

✅ New prerelease: GitHub - GoogleFonts v1.0.129-perfinstallimprovements003

@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLFail ❌
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

Super-linter detected linting errors

For more information, see the GitHub Actions workflow run

Powered by Super-linter

POWERSHELL

�[32;1mRuleName �[0m�[32;1m Severity �[0m�[32;1m ScriptName�[0m�[32;1m Line �[0m�[32;1m Message�[0m
�[32;1m-------- �[0m �[32;1m-------- �[0m �[32;1m----------�[0m �[32;1m---- �[0m �[32;1m-------�[0m
PSProvideCommentHelp Information Measure-In 16 The cmdlet 'I
stallPerfo nvoke-Uninsta
rmance.ps1 ll' does not
have a help c
omment.
PSProvideCommentHelp Information Measure-In 26 The cmdlet 'M
stallPerfo easure-Scenar
rmance.ps1 io' does not
have a help c
omment.

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

src/functions/public/Install-GoogleFont.ps1:267

  • Same as the parallel path: to ensure the retry loop behaves correctly, Invoke-WebRequest should be invoked with -ErrorAction Stop so non-terminating web cmdlet errors don't bypass the catch and get treated as successes.
 $currentProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
try {
Invoke-WebRequest -Uri $item.URL -OutFile $item.DownloadPath
} finally {

Comment threadsrc/functions/public/Install-GoogleFont.ps1
Comment threadsrc/functions/public/Install-GoogleFont.ps1
…to Invoke-WebRequest for retry reliability
- Move $previousProgressPreference assignment before the admin-rights check
so it is always initialized when the clean block runs (prevents restore
if the function throws before reaching the original assignment)
- Add -ErrorAction Stop to both Invoke-WebRequest calls (parallel and sequential
paths) so non-terminating HTTP/network errors are reliably caught by the retry
try/catch loop
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLPass ✅
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
…n PS 5.1-compatible
- Add -ErrorAction Stop to all Copy-Item calls inside try/catch blocks
(cache-read on line 199, cache-write on lines 236 and 274) so
non-terminating errors reliably enter the catch path
- Replace bare $IsWindows/$IsMacOS checks with version-gated
variables ($isWin/$isMac) that correctly treat PS 5.1 (which
lacks those automatic variables) as Windows
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLPass ✅
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

Comment threadsrc/functions/public/Install-GoogleFont.ps1
Comment threadsrc/functions/public/Install-GoogleFont.ps1
Comment threadsrc/functions/public/Install-GoogleFont.ps1 Outdated
… check
- Emit Write-Verbose with resolved cache root path for discoverability
- Add per-item cache-miss verbose messages before download phase
- Replace -like wildcard with .StartsWith() to avoid special char issues
and wildcard parsing overhead in installed-font detection
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLPass ✅
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment threadsrc/functions/public/Install-GoogleFont.ps1

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comment threadsrc/functions/public/Install-GoogleFont.ps1
Comment threadsrc/functions/public/Install-GoogleFont.ps1
…es from prefix scan
The previous prefix-only StartsWith check falsely marked fonts as installed
when a different font family shared the same prefix (e.g., 'Roboto Condensed'
installed would incorrectly skip 'Roboto').
Now uses a two-step approach:
1. Exact HashSet.Contains check (primary - O(1))
2. Prefix fallback that excludes matches which are themselves known Google
Font family names, preventing cross-family false positives
@github-actions

Copy link
Copy Markdown
Contributor

Super-linter summary

LanguageValidation result
CHECKOVPass ✅
GITHUB_ACTIONSPass ✅
GITHUB_ACTIONS_ZIZMORPass ✅
GITLEAKSPass ✅
GIT_MERGE_CONFLICT_MARKERSPass ✅
JSONPass ✅
MARKDOWNPass ✅
NATURAL_LANGUAGEPass ✅
POWERSHELLPass ✅
PRE_COMMITPass ✅
SPELL_CODESPELLPass ✅
TRIVYPass ✅
YAMLPass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@MariusStorhaug
Marius Storhaug (MariusStorhaug) merged commit 9040cdf into mainMay 18, 2026
45 checks passed
@MariusStorhaug
Marius Storhaug (MariusStorhaug) deleted the perf/install-improvements branch May 18, 2026 23:40
@github-actions

Copy link
Copy Markdown
Contributor

✅ New release: PowerShell Gallery - GoogleFonts 1.1.0

@github-actions

Copy link
Copy Markdown
Contributor

✅ New release: GitHub - GoogleFonts v1.1.0

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

Labels

MinorFeature updates that are backwards compatible

Projects

None yet

2 participants

@MariusStorhaug