Grouping codes to improve performance