Improve type conversion performance by reducing key iteration