Does rapid layer changing affect performance?

Hi, in my script i every frame move quite a few objects to “Ignore Raycast” layer and then back to their original layer to prevent them being detected obviously. So i’m just wondering is it gonna affect performance a lot, especially for mobile. Personally i didn’t noticed much difference in the profiler. Thank you!

I think having multiple layers don’t affect performance that much because is just a way to reference things.
But move object through layers every single frame I think it will affect performance.
Check this it might help https://unity3d.com/pt/learn/tutorials/topics/physics/physics-best-practices