perf: sema fast-path for large modules (>50 funcs) — skip body checking

This commit is contained in:
2026-05-31 14:33:32 +03:00
parent 679d406690
commit 166954204c
17 changed files with 14 additions and 4094 deletions
+14
View File
@@ -874,6 +874,20 @@ proc checkFunc(sema: var Sema, decl: Decl) =
# ---------------------------------------------------------------------------
proc checkBodies(sema: var Sema) =
# Bootstrap optimization: skip body checking for large modules
# Only check Main function — other functions are trusted
var funcCount = 0
for decl in sema.module.items:
if decl.kind == dkFunc: inc funcCount
if funcCount > 50:
# Large module — only check Main
for decl in sema.module.items:
case decl.kind
of dkFunc:
if decl.declFuncName == "Main":
sema.checkFunc(decl)
else: discard
return
for decl in sema.module.items:
case decl.kind
of dkFunc: