Skip to content

Commit

Permalink
refactor: powershell optimisation (ngen) rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
he3als committed Feb 22, 2024
1 parent 140ad0f commit d5ecfc5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/playbook/Configuration/custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
title: Root Playbook File
description: Runs all of the playbook files
privilege: TrustedInstaller
actions: []
actions:
- !writeStatus: {status: 'Optimizing PowerShell'}
tasks:
# Configure PowerShell first so that other PowerShell scripts work
# NGEN - PowerShell optimization
- tweaks\statuses\status-ngen.yml
# NGEN - .NET assemblies PowerShell optimization
- tweaks\scripts\script-ngen.yml
- tweaks\qol\config-powershell.yml

Expand Down
6 changes: 0 additions & 6 deletions src/playbook/Configuration/tweaks/statuses/status-ngen.yml

This file was deleted.

16 changes: 5 additions & 11 deletions src/playbook/Executables/NGEN.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
# speeds up powershell startup time by 10x
$env:path = $env:path + ";" + $([Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory())
[AppDomain]::CurrentDomain.GetAssemblies() | % {
if (! $_.location) {continue}
$Name = Split-Path $_.location -leaf
Write-Host -ForegroundColor Yellow "NGENing : $Name"
ngen install $_.location | % {"`t$_"} | Out-Null
}

# run these tasks in the background to make sure that it is all ngened
& schtasks.exe /Run /TN "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319"
& schtasks.exe /Run /TN "\Microsoft\Windows\.NET Framework\.NET Framework NGEN v4.0.30319 64"
$env:path = "$([Runtime.InteropServices.RuntimeEnvironment]::GetRuntimeDirectory());" + $env:path
[AppDomain]::CurrentDomain.GetAssemblies().Location | ? {$_} | % {
Write-Host "NGENing: $(Split-Path $_ -Leaf)" -ForegroundColor Yellow
ngen install $_ | Out-Null
}

0 comments on commit d5ecfc5

Please sign in to comment.