From af713a9e1bd9c483465e3d0b0ea7ea4786c0b42f Mon Sep 17 00:00:00 2001 From: opariffazman Date: Tue, 23 Jun 2026 20:25:51 +0800 Subject: [PATCH] perf(release): trim AIGS engines, skip compressing TRT blobs, time installer build - manifest: VfxModelGlobs -> AIGS_*_m0* (green-screen MODE is hardcoded 0 in aigs.cpp, so only m0 engines ever load). Drops m1/m2/m3 -> ~290 MB off the multi-arch bundle. - installer: ship .trtpkg engines with nocompression + exclude them from the catch-all, so the solid lzma2/ultra64 block stops re-compressing already- compressed TensorRT blobs. Faster release build, no double-pack. - build-installer: stopwatch timing split per step (shim/dotnet/bundle/iscc) so the next release run shows where the ~7 min goes. ci.yml is untouched (already <1 min on the self-hosted runner); the slow path was release.yml's installer build. Co-Authored-By: Claude Opus 4.8 (1M context) --- installer/CameraOnScreen.iss | 7 ++++- native/shim/bundle/maxine-manifest.psd1 | 6 ++++- scripts/build-installer.ps1 | 36 +++++++++++++++++++------ 3 files changed, 39 insertions(+), 10 deletions(-) diff --git a/installer/CameraOnScreen.iss b/installer/CameraOnScreen.iss index c9b3439..523a500 100644 --- a/installer/CameraOnScreen.iss +++ b/installer/CameraOnScreen.iss @@ -41,7 +41,12 @@ Name: "english"; MessagesFile: "compiler:Default.isl" Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked [Files] -Source: "{#SourceDir}\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs ignoreversion +; TensorRT engine packages (.trtpkg) are already-compressed blobs — running them through the +; solid lzma2/ultra64 block burns minutes of compile time for ~0 size win. Ship them with +; nocompression. This entry MUST precede the catch-all (Inno uses the first matching rule). +Source: "{#SourceDir}\maxine\models\*"; DestDir: "{app}\maxine\models"; Flags: nocompression recursesubdirs createallsubdirs ignoreversion +; Excludes the engines from the catch-all so they aren't packed a second time (compressed). +Source: "{#SourceDir}\*"; DestDir: "{app}"; Excludes: "*.trtpkg"; Flags: recursesubdirs createallsubdirs ignoreversion ; Ship the consolidated third-party notices into the install dir (repo-root file, path ; relative to this .iss). The per-SDK NVIDIA notice texts already ride inside {#SourceDir}\maxine\. Source: "..\THIRD-PARTY-NOTICES.md"; DestDir: "{app}"; Flags: ignoreversion diff --git a/native/shim/bundle/maxine-manifest.psd1 b/native/shim/bundle/maxine-manifest.psd1 index 39cef99..4b30239 100644 --- a/native/shim/bundle/maxine-manifest.psd1 +++ b/native/shim/bundle/maxine-manifest.psd1 @@ -45,8 +45,12 @@ # Model engines, copied from the stage's models\{vfx,ar}. Broad per-effect globs so the bundle # ships whatever arches are staged (sm75/86/89/100) -- arch selection happens at fetch time # (scripts/fetch-maxine-engines.ps1 -Arches). VFX -> models\vfx, AR -> models\ar. + # Green-screen MODE is hardcoded to 0 in aigs.cpp (Probe + Start) -> only the m0 engines + # (m0 + its m0_1_4_8 batch variant) ever load. Shipping m1/m2/m3 was ~73 MB/arch of dead + # weight (~290 MB across the 4 arches). Widen this glob back to 'AIGS_*' if a quality-mode + # selector is ever exposed in the UI -> shim. VfxModelGlobs = @( - 'AIGS_*.engine.trtpkg' + 'AIGS_*_m0*.engine.trtpkg' ) ArModelGlobs = @( 'gazeredir_*.engine.trtpkg' diff --git a/scripts/build-installer.ps1 b/scripts/build-installer.ps1 index 3bd18fe..095081a 100644 --- a/scripts/build-installer.ps1 +++ b/scripts/build-installer.ps1 @@ -64,6 +64,18 @@ function Assert-ShimHasEffects { if ($isStub) { throw "deployed shim is the passthrough STUB ('not built in' present)" } } +# One-time timing split so the next release run shows where the ~7 min goes (shim vs dotnet vs +# ISCC). Stopwatch, NOT Measure-Command — the latter swallows the child build stdout we need in CI. +$script:Timings = [ordered]@{} +function Invoke-Timed { + param([string]$Label, [scriptblock]$Block) + $sw = [System.Diagnostics.Stopwatch]::StartNew() + & $Block + $sw.Stop() + $script:Timings[$Label] = $sw.Elapsed.TotalSeconds + Write-Host ("[timing] {0}: {1:N1}s" -f $Label, $sw.Elapsed.TotalSeconds) -ForegroundColor DarkCyan +} + $isccExe = Resolve-Iscc -Explicit $IsccPath if ($DryRun) { @@ -79,9 +91,11 @@ if ($DryRun) { # 1. Native shim, SDK config, LAST (deploy-the-right-shim gotcha). if (-not $SkipShimBuild) { - $msbuild = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" - & $msbuild $shimProj /p:Configuration=$Configuration /p:Platform=x64 /warnaserror /nologo - if ($LASTEXITCODE -ne 0) { throw "shim build failed ($LASTEXITCODE)" } + Invoke-Timed 'shim-build' { + $msbuild = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe" + & $msbuild $shimProj /p:Configuration=$Configuration /p:Platform=x64 /warnaserror /nologo + if ($LASTEXITCODE -ne 0) { throw "shim build failed ($LASTEXITCODE)" } + } } # 2. Build App, .NET self-contained, into the staging dir. @@ -97,24 +111,30 @@ if (Test-Path -LiteralPath $StagingDir) { Remove-Item -Recurse -Force -LiteralPath $StagingDir } New-Item -ItemType Directory -Force -Path $StagingDir | Out-Null -dotnet build $appProj -c $Configuration -r win-x64 -p:SelfContained=true -p:Platform=x64 -t:Rebuild -o $StagingDir --nologo -if ($LASTEXITCODE -ne 0) { throw "dotnet build failed ($LASTEXITCODE)" } +Invoke-Timed 'dotnet-build' { + dotnet build $appProj -c $Configuration -r win-x64 -p:SelfContained=true -p:Platform=x64 -t:Rebuild -o $StagingDir --nologo + if ($LASTEXITCODE -ne 0) { throw "dotnet build failed ($LASTEXITCODE)" } +} # 3. Export-verify the deployed shim BEFORE packaging. Assert-ShimHasEffects -Dll (Join-Path $StagingDir 'CameraOnScreen.Shim.dll') # 4. Bundle the Maxine runtime into \maxine\ by pruning the pre-assembled stage. if (-not $MaxineStage) { throw "no -MaxineStage (or `$env:COS_MAXINE_STAGE) — assemble one first with scripts/assemble-maxine-stage.ps1" } -& $bundler -OutDir $StagingDir -MaxineStage $MaxineStage +Invoke-Timed 'bundle-maxine' { & $bundler -OutDir $StagingDir -MaxineStage $MaxineStage } if (-not (Test-Path -LiteralPath (Join-Path $StagingDir 'maxine'))) { throw "bundler did not produce maxine\ in $StagingDir" } # 5. Compile the installer. $stagedExe = Join-Path $StagingDir 'CameraOnScreen.App.exe' if (-not (Test-Path -LiteralPath $stagedExe)) { throw "staging is missing CameraOnScreen.App.exe — publish incomplete; refusing to package" } New-Item -ItemType Directory -Force -Path (Join-Path $repo 'dist') | Out-Null -& $isccExe $iss "/DSourceDir=$StagingDir" "/DAppVersion=$Version" -if ($LASTEXITCODE -ne 0) { throw "ISCC compile failed ($LASTEXITCODE)" } +Invoke-Timed 'iscc-compile' { + & $isccExe $iss "/DSourceDir=$StagingDir" "/DAppVersion=$Version" + if ($LASTEXITCODE -ne 0) { throw "ISCC compile failed ($LASTEXITCODE)" } +} $size = (Get-Item -LiteralPath $output).Length Write-Host ("installer -> {0}" -f $output) Write-Host (" size : {0:N0} bytes ({1:N2} GB)" -f $size, ($size / 1GB)) +Write-Host "--- timing split ---" +foreach ($k in $script:Timings.Keys) { Write-Host (" {0,-14} {1,6:N1}s" -f $k, $script:Timings[$k]) }