This is a major performance-focused release, delivering significant improvements to both execution speed and memory usage. Through a series of targeted optimizations, Mago is now substantially faster on small-to-medium codebases and drastically leaner on large ones.
🚀 Performance Improvements
This release cycle has been dedicated to making Mago faster and more efficient. Benchmarks comparing this release (1.0.0-alpha.6
) with 1.0.0-alpha.4
show the following results ( mago analyze
):
Project | Metric | 1.0.0-alpha.4
| 1.0.0-alpha.6
| Improvement |
---|---|---|---|---|
PSL (Small) | Speed | 143.2 ms | 118.6 ms | ~21% Faster |
Memory | 174.80 MB | 154.67 MB | -11.5% Memory | |
WordPress (Large) | Speed | 7.016 s | 6.692 s | ~5% Faster |
Memory | 2065.36 MB | 1855.00 MB | -10.2% Memory |
On the large WordPress codebase, these changes resulted in over 210 MB of RAM savings, making the analyzer more capable of handling massive projects.
Key optimizations include:
Span
Size Reduction: The coreSpan
struct was reduced in size by 50% (from 32 to 16 bytes), dramatically lowering memory usage.- Parallel File Loading: The database loader now uses
rayon
to discover and read files in parallel, providing a significant speedup on small projects. - Efficient Data Structures: Core data structures in the
codex
andalgebra
crates were migrated fromBTreeMap
toIndexMap
for faster lookups. - Memory Sharing with
Cow
andArc
: The database was refactored to use Copy-on-Write strings andArc
to share file data cheaply across threads.
🐛 Fixes & Improvements
- CI & Tests: Corrected a build failure and fixed broken tests that affected the
1.0.0-alpha.5
release. - Stubs: Added missing public properties to the
DateInterval
class stub for more accurate analysis. (by @Bleksak in #273) - Analyzer: Improved template type inference when converting between
list
and keyed arrays. - Formatter: Fixed an issue where the formatter would incorrectly add newlines for arguments that were already multi-line constructs. (Closes #244)
- Typos: Corrected various typos across multiple crates. (@szepeviktor in #276)
🛠️ Chores & Refactoring
- Docs: Improved the formatting of the main
README.md
file. (by @szepeviktor in #278) - The
rand
dependency has been removed from themago-algebra
crate. - Unnecessary
#[repr(C)]
attributes were removed from AST and span structs. - Added new badges to the project
README
.
New Contributors
- @szepeviktor made their first contribution in #276
- @Bleksak made their first contribution in #273
Full Changelog: 1.0.0-alpha.4...1.0.0-alpha.6