selectors, since the performance increases when reducing the number of them and stays the same otherwise
The datapack will cause a lot more lag when holding a carrot on a stick, because it does an initial check for holding the carrot on a stick and then further checks for the custom model data if they are
I have provided the datapack, along with an example of playerdata that causes lag
The main cause of the lag seems to be
@s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick",tag:{}}}{{{}{CustomModelData:2}{}}}{{{}}}]
selectors, since the performance increases when reducing the number of them and stays the same otherwise
The datapack will cause a lot more lag when holding a carrot on a stick, because it does an initial check for holding the carrot on a stick and then further checks for the custom model data if they are