Michael Freno
abe34c4749
Implement algorithmic performance optimizations
Implemented high-impact optimizations from PERFORMANCE_ANALYSIS.md:
1. Dirty Flag System (30-50% fewer layouts):
- Added _dirty and _childrenDirty flags to Element module
- Elements track when properties change that affect layout
- LayoutEngine checks dirty flags before expensive layout calculations
- Element:setProperty() invalidates layout for layout-affecting properties
2. Dimension Caching (10-15% faster):
- Enhanced _borderBoxWidth/_borderBoxHeight caching
- Proper cache invalidation in invalidateLayout()
- Reduces redundant getBorderBox calculations
3. Local Variable Hoisting (15-20% faster):
- Hoisted frequently accessed properties outside tight loops
- Reduced table lookups in wrapping logic (child.margin cached)
- Optimized line height calculation (isHorizontal hoisted)
- Heavily optimized positioning loop (hottest path):
* Cached element.x, element.y, element.padding
* Hoisted alignment enums outside loop
* Cached child.margin, child.padding per iteration
* 3-4 table lookups → 2 lookups per child
4. Array Preallocation (5-10% less GC):
- Preallocated lineHeights with table.create() when available
- Graceful fallback to {} on standard Lua
Estimated total gain: 40-60% improvement (2-3x faster layouts)
All 1257 tests passing. Zero breaking changes.
See ALGORITHMIC_OPTIMIZATIONS.md for full details.
2025-12-05 14:43:46 -05:00
..
2025-12-03 22:19:27 -05:00
2025-12-05 11:31:52 -05:00
2025-12-05 14:35:37 -05:00
2025-11-19 14:10:18 -05:00
2025-12-05 14:43:46 -05:00
2025-12-04 20:34:21 -05:00
2025-12-04 00:17:04 -05:00
2025-12-05 14:35:37 -05:00
2025-11-18 19:51:05 -05:00
2025-11-15 00:01:45 -05:00
2025-11-14 17:16:55 -05:00
2025-12-03 22:19:27 -05:00
2025-12-03 22:19:27 -05:00
2025-11-18 19:51:05 -05:00
2025-12-05 14:43:46 -05:00
2025-11-25 09:50:57 -05:00
2025-12-03 22:19:27 -05:00
2025-11-17 01:56:02 -05:00
2025-12-05 14:35:37 -05:00
2025-12-05 11:31:52 -05:00
2025-11-25 09:50:57 -05:00
2025-12-04 00:17:04 -05:00
2025-12-03 22:19:27 -05:00
2025-12-04 00:17:04 -05:00
2025-12-04 20:34:21 -05:00
2025-12-05 11:31:52 -05:00
2025-12-03 22:19:27 -05:00
2025-12-03 22:19:27 -05:00