Repository navigation
Build Optimizations
Audience: Programmers
Thread Context: N/A (development/process reference)
Platform/Backend Scope: All platforms (build/CI/git; commands shown for Linux/bash)
Concrete time and effort savers for build, CI diagnosis, and git workflows. These are faster or more reliable alternatives to the obvious first approach. They apply to any session involving building, testing, CI diagnosis, or git operations in SparkEngine. These are not correctness fixes — the default approaches work — they are efficiency improvements.
Always pass --parallel $(nproc) to cmake --build to exploit all available CPU cores:
cmake --build build --config Release --parallel $(nproc)Without this flag, CMake builds single-threaded by default on some configurations, which is dramatically slower on multi-core hosts.
Notes:
-
$(nproc)is Linux/bash-specific. On macOS use$(sysctl -n hw.logicalcpu). On Windows PowerShell, the MSVC generator parallelizes by default with--parallel(no count needed), or use$env:NUMBER_OF_PROCESSORS. - All Linux CI jobs already use
--parallel $(nproc)(macOS uses$(sysctl -n hw.logicalcpu)) — this makes local builds match CI speed.
When a CI run fails, skip reading the full log. Use --log-failed to download only the failed job output:
# Get run ID first
gh run list --branch "$(git branch --show-current)" --limit 3
# Download only failed logs (much smaller, faster to scan)
gh run view <RUN_ID> --log-failedNotes:
- Full logs (
gh run view <RUN_ID> --log) can be very large — often 10-50 MB for all jobs. -
--log-faileddownloads only the logs from jobs with afailureconclusion. - This repo also uploads per-job error-summary artifacts (
ci-errors-*) and areport-ci-errorsaggregation job — downloading those can be even faster than--log-failed. - See GitHub API and PR Checks for the full PR check diagnosis workflow.
Before running git rebase origin/Working, check how many commits you are behind. This tells you whether to expect conflicts and how many:
git log --oneline HEAD..origin/Working | wc -l| Output | Action |
|---|---|
0 |
Branch is up to date — skip rebase entirely |
1-3 |
Straightforward rebase, unlikely to conflict |
4-10 |
Moderate delta — read commit messages before rebasing |
10+ |
Large delta — review commits first with git log --oneline HEAD..origin/Working
|
Notes:
- See Git Rebase Conflicts for conflict resolution strategies.
- Checking first prevents surprises mid-rebase on large divergences.
For a quick status snapshot without risk of hanging, use plain gh pr checks (no flags) rather than --watch:
# Quick snapshot — does not hang
gh pr checks
# Then use run list + view for details on failures
gh run list --branch "$(git branch --show-current)" --limit 3
gh run view <RUN_ID>gh pr checks --watch is designed for interactive terminals and can hang indefinitely in non-TTY environments.
Notes:
- See GitHub API and PR Checks for the full polling workflow.
- Ignore exit code 1 from
gh pr checksif checks are still running — the non-zero exit is not meaningful while checks are in progress.
Use the -N flag to do a CMake dry-run that prints all resolved options without actually configuring:
cmake --preset linux-gcc-release -NUseful for verifying which CMake toggles (ENABLE_NETWORKING, ENABLE_DXR, etc.) are set by a preset before committing to a full configure.
Notes:
- Much faster than a full configure when you just need to check a flag.
- Many toggles are OFF by default (e.g.
ENABLE_VULKAN,ENABLE_OPENGL,ENABLE_METAL,ENABLE_DXR,SPARK_DOUBLE_PRECISION_PHYSICS);ENABLE_NETWORKING,ENABLE_EDITOR,ENABLE_GRAPHICS, andBUILD_GAME_MODULESare ON. SeeCLAUDE.md"Build" for the authoritative toggle list.
CI uses compiler caches to speed up incremental builds: ccache on the Linux jobs and sccache on the two Windows MSVC lanes (build-windows-vs2022, build-windows-vs2026), passed via -DCMAKE_C_COMPILER_LAUNCHER=sccache / -DCMAKE_CXX_COMPILER_LAUNCHER=sccache. If you reproduce a CI job locally and have ccache/sccache installed, adding the same launcher flags makes repeat builds far faster; otherwise omit them.
The Windows contract (since 2026-09-06):
-
Generator:
-G "Ninja Multi-Config"inside the Visual Studio developer environment (Enter-VsDevShell -VsInstallPath <vs> -SkipAutomaticLocation -DevCmdArguments "-arch=x64 -host_arch=x64", which also putscl,rc,ninjaand the Windows SDKfxcon PATH) (fxc discovery and the foliage shader validations are expected fromfind_program(FXC_EXECUTABLE ...); no CI run at this tree has confirmed them yet). Visual Studio generators ignoreCMAKE_<LANG>_COMPILER_LAUNCHER, which is why the earlier sccache step on the VS-generator lane was inert.build-windows-shippingstill configures through itswindows-shippingpreset (Visual Studio 17 2022 generator) and uses no compiler cache. -
Tool: sccache v0.17.0 downloaded from the GitHub release and verified against a SHA-256 literal in the workflow; a hash mismatch or failed download fails the job before any compile.
mozilla-actions/sccache-actionis no longer used. -
Cache:
SCCACHE_DIRunderrunner.temp, restored and saved with splitactions/cache/restore/actions/cache/savesteps keyedsccache-windows-<lane>-<config>-<hashFiles of CMakeLists.txt and *.cmake>-<sha>(the same shape as the Linux ccache keys). The save step runs under!cancelled(), so a job that went red (compile error, test gate) still saves the objects it produced.build/is never restored on these lanes any more. -
Flags:
-DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON(sccache cannot cache/Yc//Fp),-DCMAKE_CXX_SCAN_FOR_MODULES=OFF(no module units exist),-DGENERATE_DEBUG_SYMBOLS=OFF(removes Jolt's/Zi, which would otherwise make sccache demand a PDB thatclnever writes under the engine's/Z7), plus-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embeddedas a guard for the pin the top-levelCMakeLists.txtalready sets beforeproject(). -
Evidence: the
Print sccache statsstep (the server is kept alive withSCCACHE_IDLE_TIMEOUT=0until--stop-server) writes the stats to the job summary and emits::warning::annotations for 0 compile requests, non-zero cache error counters, or a cold restore; it never fails the job.
- Original entry:
Build and CI Workflow Optimizations, last updated 2026-03-14. - Verified against codebase 2026-06-08.
- Updated / found stale:
- Added a Windows/PowerShell note for
--parallel(the$(nproc)form is bash-only). - Added the
ci-errors-*artifacts /report-ci-errorsjob as a faster-than---log-failedoption (new since source). - Added a ccache/sccache section documenting the compiler-cache launcher flags CI now uses.
- Rewrote the Windows part of that section (2026-09-06): the vs2022/vs2026 lanes now use Ninja Multi-Config + hash-pinned sccache with split restore/save on
SCCACHE_DIR; the earlier claim that the Visual Studio-generator lanes passed launcher flags was false (the sccache step there was inert). - Refreshed the default-OFF/ON toggle list against current
CLAUDE.md(source pointed at acodebase-observations.mdfile not migrated here). - Retargeted cross-references to the migrated wiki pages.
- Added a Windows/PowerShell note for
- GitHub API and PR Checks — full PR check diagnosis workflow
- Git Rebase Conflicts — conflict resolution strategies
- CI Reproducible Builds — per-job local reproduction commands
- Workflow Patterns — pre-push and session-start checklists
- Project conventions (CLAUDE.md) — "Build" toggle list
Published from 2b03dc797148. Edit the canonical source in wiki/.
- Documentation
- Docs route
- Wiki index
- Guides
- Tutorials
- Samples
- Examples
- API Reference
- API route
- Reference
- Build Guide
- Dependencies
- FAQ
- Changelog
- Roadmap
- Contributing
- Code of Conduct
- Home
- FAQ
- Getting Started
- Quick-Start Tutorial
- Making Your First Game
- Making Your First Multiplayer Game
- Artist Workflow Guide
- Editor Walkthrough
- Migration Guide
- How SparkEngine Works
- Architecture Overview
- Engine Architecture Flowchart
- Creating a Game Module
- Game Modules (catalog)
- Entity Component System
- Rendering and Graphics
- Physics
- Cloth Simulation
- Audio
- Input System
- Camera System
- Scripting with AngelScript
- Visual Scripting
- AI and Navigation
- Animation
- 2D Systems
- Networking
- Dedicated Server
- Multiplayer Quick Start
- Area Server Architecture
- Scene Management
- Large World Support
- Collaborative Editing
- Coroutine System
- Event System
- Event Response System
- Job System
- UI System
- UI Layout Extensions
- Localization
- Dialogue System
- Destruction System
- Replay System
- Achievement System
- Loading System
- Mod System
- Content Delivery
- Tween System
- Memory Integrity
- Gameplay Systems
- Terrain and Procedural Generation
- Save System
- Persistence System
- Day Night Cycle and Weather
- Cinematic Sequencer
- Runtime Prefabs
- SparkEditor
- Editor Tutorials
- SparkConsole
- SparkDaemon
- Shader Pipeline
- Asset Pipeline
- Asset Validation
- Asset Migration
- Game Packaging
- Online Services
- DataTable System
- Loot and Crafting System
- CSG System
- Font System
- Timer Manager
- Movie Render Pipeline
- HLOD and World Partition
- Remote Debug System
- Selection Manager
- Asset Dependency Graph
- Editor Automation
- File Watcher
- Project Templates
- System Requirements
- VR Support
- Mobile Platform
- Accessibility
- Platform Input
- Platform Certification
- Cross-Compilation: Wine Testing
- RHI Abstraction Layer
- D3D11 Backend
- D3D12 Backend
- Vulkan Backend
- OpenGL Backend
- Metal Backend
- DXR Raytracing
- Hybrid Ray Tracing
- Upscaling (DLSS/FSR)
- Render Graph
- Shader Graph
- GPU Particles
- GPU-Driven Rendering
- Volumetric Fog
- Volumetric Clouds
- Global Illumination
- Virtual Texturing
- Water Rendering
- Clustered Lighting
- Material System
- Post-Processing
- Shadow System
- Particle System
- Decal System
- Sky and Atmosphere
- Foliage System
- Mesh Shaders
- Neural Rendering
- Configuration Reference
- Performance Tips
- Benchmark Framework
- Threading Model
- Fuzz Policy and Parser Security
- Memory Safety
- Memory Management Patterns
- Build System and CMake Modules
- Profiler and Debugging
- Performance Profiling Guide
- Telemetry System
- Crash Reporting
- Golden Image Testing
- Utilities
- Testing
- Fuzz Policy and Parser Security
- Codebase Statistics
- Codebase Health
- Error Handling Patterns
- Hot Reload Overview
- Troubleshooting
- Contributing
- Workflow Patterns
- Build Optimizations
- CI Reproducible Builds
- GitHub API and PR Checks
- Git Rebase Conflicts
- Clang-Format
- Code Quality Violations
- AI Bloat Pattern
- MinGW + Wine Cross-Compilation
- Live Editor Testing
- Engine & Renderer Landscape
- DuetOS Portability Catalog
- Five-Engine Analysis
- Eleven-Engine Analysis
- ThorVG / Unity Graphics Analysis
- Advanced Techniques Catalog
- Third-Party Library Evaluation
- Engine Viability Evaluation
- Engine Feature Recommendations
- Project Recommendations
- Mac Compatibility Analysis
- Codebase Observations
- Codebase Bloat Audit
- Test Suite Audit
- Documentation Coverage Audit
- ThirdParty Dependencies Audit
- Load Test Baseline
- Gameplay Systems Status
- SparkGame Module Status
- Stub and Abandoned Features
- Memory Integrity System
- Memory Safety Evaluation
- Hardware Acceleration Systems
- Jolt Physics Integration
- GPU/CPU Separation Plan
- Daemon Services Architecture
- Reflection & Polymorphism Refactoring Plan
- SparkBuild In-Tree
- Wine No-JobSystem Breakthrough
- Wine Role and Fallback Tiers