Tick Function Optimization

I have this function which runs every tick: execute as @a run attribute @s max_health modifier remove minecraft:amethyst_necklace execute as @a[nbt={Inventory:[{Slot:17b,id:"minecraft:poisonous_potato",components:{"minecraft:item_model":"ckcresources:amethyst_necklace"}}]}] run attribute @s max_health modifier add minecraft:amethyst_necklace .1 add_value It takes away a max health effect every frame. If the player has an amethyst necklace equipped (located on the inventory slot with the slot data: 17b), then a max_health modifier will apply after it has been taken away. This method ensures that the player will not have a health boost unless they have an amethyst necklace equiped. Is this command chain the correct way to achieve this effect--especially if I am going to use the same method for other items? If I'm being inefficient, what should I do?
Continue to help post