constexpr means running code at compile time. template means duplicating lots of code lots of times. these are not cheap.
In many cases it's possible to only declare the template in the header, explicitly instantiate it with a bunch of types in a single TU, and just find those definitions via linker.