Skip to content

Commit 01f6797

Browse files
committed
fix: profiler: try to eagerly use the midtier when possible
1 parent cab2fbb commit 01f6797

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

nim.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ warning:UnreachableCode:off
1515

1616
# Engine logging controls
1717
# -d:baliLogVmDbg
18-
-d:baliLogJitDbg
18+
# -d:baliLogJitDbg
1919
# -d:baliLogExecDbg
2020

2121
@if not release:

src/bali/runtime/vm/interpreter/interpreter.nim

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,15 @@ proc shouldCompile*(
10321032
# TODO: implement more heuristics
10331033
case judgement
10341034
of CompilationJudgement.Eligible:
1035-
return (gettingCompiled: true, tier: some(Tier.Baseline))
1035+
# If the function is trivial (< 4 ops), then we can just put it through
1036+
# the baseline compiler. Otherwise, we can put it through the midtier
1037+
# since it's leaps faster and doesn't take a lot of extra time to do
1038+
# its thingmajig.
1039+
1040+
if clause.operations.len < 4:
1041+
return (gettingCompiled: true, tier: some(Tier.Baseline))
1042+
else:
1043+
return (gettingCompiled: true, tier: some(Tier.Midtier))
10361044
of CompilationJudgement.WarmingUp:
10371045
return (gettingCompiled: true, tier: some(Tier.Midtier))
10381046
else:

0 commit comments

Comments
 (0)