Skip to content

Resolve compiler type-checker bottlenecks and add profiling workflow - #59

Merged
ctreffs merged 23 commits into
masterfrom
build-optimizations
Aug 24, 2026
Merged

Resolve compiler type-checker bottlenecks and add profiling workflow#59
ctreffs merged 23 commits into
masterfrom
build-optimizations

Conversation

@ctreffs

@ctreffs ctreffs commented Aug 24, 2026

Copy link
Copy Markdown
Member

Summary

Swift type-checker constraint solver bottleneck fix. Reduced compiler frontend wall-clock time from 49.78s to 20.62s (58.6% faster), eliminating >45 Billion CPU instructions per clean build pass.

Changes

  • Foundation Imports: Replaced file-scope import Foundation across 29 function files with platform-conditional imports (#if canImport(Darwin) ...). Bypasses Objective-C Foundation symbol graph loading on Darwin.
  • Literal Typing: Added explicit types for floating-point and vector literals in Constants.swift, Matrix+Identity.swift, Quaternion+Identity.swift, Quat4f+Euler.swift, cross.swift.
  • Expression Decomposition: Un-nested 4x4, 3x3, 2x2 matrix multiplication expressions in Matrix+Multiplication.swift into explicit intermediate typed local variables (let c00: Float = ...).
  • Function Resolution: Simplified classification functions (isNegativeInfinity.swift, isPositiveInfinity.swift, isNegativeZero.swift, isPositiveZero.swift, isInfinite.swift, distance.swift, axis.swift, clamp.swift, remap.swift).
  • Inlinables & Qualification: Added @inlinable annotations and explicit FirebladeMath qualifications in operator functions.
  • Profiling Workflow: Added Scripts/profile-compiler-stats.sh and Scripts/benchmark-commits.py with Makefile targets (profile-stats, benchmark-commits).

Verification

  • make test: All 258 unit tests pass.
  • make lint: All sources pass formatting/linting rules.
  • make profile-stats: Frontend compilation wall-clock time < 21s.

ctreffs added 21 commits August 24, 2026 08:17
@ctreffs ctreffs changed the title perf: resolve compiler type-checker bottlenecks and add profiling workflow Resolve compiler type-checker bottlenecks and add profiling workflow Aug 24, 2026
@ctreffs
ctreffs marked this pull request as ready for review August 24, 2026 07:44
@ctreffs ctreffs self-assigned this Aug 24, 2026
@ctreffs
ctreffs enabled auto-merge (squash) August 24, 2026 07:52
@ctreffs
ctreffs merged commit e45009d into master Aug 24, 2026
12 checks passed
@ctreffs
ctreffs deleted the build-optimizations branch August 24, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant