Practically I wouldn't worry about it. There are usually a lot of other things that affect performance way more, like not sharing material between objects.
There is no difference between a SpatialMaterial and a ShaderMaterial if they do the same operation and produce the same material. If you right click a SpatialMaterial and convert it into a ShaderMaterial they should have more or less identical performance.
Now, if you don't need everything the SpatialMaterial does, you can write a ShaderMaterial that does less operations, and in turn will have better performance. But I'm pretty sure the difference will be negligible, unless you have hundreads of non-shared material instances.
For example, the shader below will have better performance than the default SpatialMaterial, due to making less operations.
shader_type spatial;
render_mode unshaded;
void fragment() {
ALBEDO = vec3(1.0, 0.0, 0.0);
}