Code optimization and performance analysis