Is StaticSwitch good to optimize a shader function?

I have a portion of my material that is expensive but it is actually rarely used in game. If I set a static switch it effectively disables the complex portion of my shader but will the disabled part still affect the material’s performance?

In other words can I use StaticSwitch within a shader instead of switching manually my material at runtime when I need/don’t need the expensive effect.