It is not performance eating as you would trigger the Python controller with a keyboard sensor. This means it runs ONLY when a key gets pressed or released [dependent on the sensor configuration it might be more often].
This is much more efficient than triggering a Python controller all the time (to check if a key was pressed). SImple math: it is more likely that a key status does not change than that it changes.