valgrind optimizations