If you are willing to make code worse to micro optimize compile times (not even sure this is true) then you should not use any modern language with complex type checking (rust, swift, C#, etc).
But For C++ template combinatorics are going to dominate any slow down due to function length.