It appears that minecraft:cod AI has a memory leak and it affects performance.
MC-91621 Mobs repetitively despawn and respawn rapidly at high Y coordinates (causing lag)
MC-168748 Rapid cod spawning and despawning causing performance issues