Performance optimizations and cache improvements