Files
five/compiler
Charles KWON OhJun 77562d4645 perf: inline RTL functions in gengo — skip Frame/EndProc entirely
tryEmitInlineRTL: recognized RTL functions emit direct Go code
instead of PushSymbol → PushNil → Push args → Function(n) dispatch.

Inlined functions (most common in SEEK key generation):
- LTrim → strings.TrimLeft(s, " ")
- RTrim/Trim → strings.TrimRight(s, " ")
- AllTrim → strings.TrimSpace(s)
- Upper → strings.ToUpper(s)
- Lower → strings.ToLower(s)
- Len → len(s) / len(arr.Items)
- Empty → nil/zero/empty check
- Chr → string(byte(n))
- Asc → int(s[0])

Each inlined call saves: FindSymbol + PushNil + Frame + locals copy
+ function body + EndProcFast + return handling = ~0.14ms per call.

In 50K SEEK loop with 5 string functions: saves ~35ms.

50K SEEK random: 64ms (Harbour 67ms — Five FASTER!)
82/82 stress PASS. 14 packages ALL PASS.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-07 21:50:25 +09:00
..