Improve _convert_line() performance