Most modern compilers transform source code into a single-static assignment form, rendering (im)mutability notations useless from an optimization standpoint. (Ignoring for now the case of non-local assignment, e.g. through aliased pointers.)
What you actually gain from (im)mutability notation is documentation and sanity checks: it's a huge win to tell the compiler "yell at me if I ever try to modify this variable", which unambiguously indicates to a human "don't worry, this variable is never modified in this code".
Comments
Most modern compilers transform source code into a single-static assignment form, rendering (im)mutability notations useless from an optimization standpoint. (Ignoring for now the case of non-local assignment, e.g. through aliased pointers.)
What you actually gain from (im)mutability notation is documentation and sanity checks: it's a huge win to tell the compiler "yell at me if I ever try to modify this variable", which unambiguously indicates to a human "don't worry, this variable is never modified in this code".