perf optimizations