solving performance issues with function that runs at entity

I have a titan enemy in my datapack, and I have this running at them. can anyone spot which might be the most resource intensive? when there's more than 5 titans, lag gets pretty bad

Continue to help post