Description
I have noted that the introduction of error message classes introduces potentially serious performance regressions.
Essentially, the model is that errors can appear very frequently because they are part of retracted backtracking. So even if the program compiles OK it could have generated 10's of thousands of error messages. Previously, that was not a problem because everything in diagnostics was by-name and got forced only when the error got printed. But the new error messages do not behave this way.
E.g. MissingIdentifier takes a by-value string, which is passed a name.show. show
is an expensive operation. This should not be called everytime we generate an error.
I think as a first approximation every string in error messages should be by-name, and we should make sure the string is not forced in the initialization code of the message.