performance test and optimize