Performance material instance VS changing material

Hi, I’m trying to find out if using material instances and changing parameters is better for performance than changing the material altogether.

I want to switch the material into several different states at runtime. I can do this by using a material instance on a mesh and changing the material instance parameters at runtime. I can also do this by making a handful of different materials in the editor and changing the mesh’s material at runtime.

I’m doing the “changing” in C++ and I’m currently leaning towards “handful of different materials” simply because it prevents the code from having to know how the material is implemented. If one solution is faster than the other, then it’ll be an easy choice to make. By faster I mean, taking less CPU or GPU time… Is there another reason I should look at one solution or the other?

I did my own simple profiling and it would seem that the material instance is significantly faster. 30% to 100% faster. Does anyone have something to add or different results?

30% to 100% seems like a large span in comparison results, but on the other hand if it is only 30% faster it seems well worth using Instances when possible. I use them myself as much as possible, not only for performance, but also the ease of material changing and editing. That in itself is hard to beat.