Files
JuliaFEM.jl/src/assemblers
Jukka Aho 1539585964 perf(assemblers): Make ElementCache fully parametric for zero allocations
The core fix that eliminates all kernel allocations.

Key change:
- ElementCache{T,B} → ElementCache{T,B,IPS}
- ips::Any → ips::IPS (type parameter)

Root cause identified:
- ips::Any caused type instability (192 bytes allocated)
- Julia compiler couldn't determine concrete type at compile time
- Required runtime type checking and boxing
- Cascaded to all downstream variables

Solution impact:
- Compiler now sees concrete type: NTuple{8, IntegrationPoint{3}}
- Zero runtime type checks
- Zero boxing/unboxing
- Zero allocations ✓

Additional improvements:
- Pre-compute topology, basis, ips during cache creation
- Add X_buffer, K_blocks, u_buffer for blocked tensor assembly
- All workspace arrays pre-allocated for zero-allocation assembly

Result: 192 bytes → 0 bytes (100% reduction)

Verified by:
- @code_warntype shows ips::NTuple{8, IntegrationPoint{3}}
- @allocated shows 0 bytes for compute_element_stiffness!()
- All kernel interface methods: 0 bytes ✓
2025-11-18 20:47:10 +02:00
..