Optimize hot paths in type system: 8% performance improvement#5
Optimize hot paths in type system: 8% performance improvement#5
Conversation
Co-authored-by: CapsAdmin <204157+CapsAdmin@users.noreply.github.com>
Co-authored-by: CapsAdmin <204157+CapsAdmin@users.noreply.github.com>
Co-authored-by: CapsAdmin <204157+CapsAdmin@users.noreply.github.com>
|
@copilot the nature of luajit makes performance a little hard to measure, you'd have to measure multiple times and average there is also luajit nattlua.lua profile which gives a more detailed overview |
You're right - I've now measured with multiple runs and used the Updated Performance Measurements (5 runs averaged): Baseline (before): 6.782s ± 0.36s The Key trace stats: 45 total traces, 33% root traces, 40% stitch links, average 4.0 exits per trace - indicating good JIT compilation coverage of the optimized loops. |
Profiling identified performance bottlenecks in type operations that account for significant runtime during analysis.
Changes
Type system optimizations (nattlua/types/)
ipairswith numericforloops in hot paths (union, table, tuple)Dataarray and length in local variables to avoid repeated lookupsfind_indexbefore expensiveEqualcallsnumber.Equal()(unreachable after line 96)Parser optimizations (nattlua/parser/)
AssociateTypeby caching existence checksExample
Before:
After:
Impact
All 1353 tests pass.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.