test code optimization