TTestcase optimizations - Don't compose error msg, unless the test fails
Some tests (stress/fuzz) may calling lots (thousands...hundred thousands...) of AsserEquals (and similar). Each of them composes an error message, and throws it away.
Especially, if run with heaptrc, this can take considerable time. (I have seen tests gaining over 80% / running in 10 seconds, instead over 1 minute before).
To complete this, the MR also adds a new signature AssertEqual(FormatString, [args], Exp, Act)
. So any format
call that user code needs to be executed for building the fail message, can be deferred too, and executed only if the test fails.
The test has several commits
- Adding some apparently missing CallerAddr
- Deferring the message build, as detailed above
- Deferring user called format, as detailed above
- Deferring a call to CallerAddr - same idea / This commit only moves the call, no extra code needed
- Deferring a call to CallerAddr - same idea / This needs extra code to check in the current function instead of just forwarding the call
Point 5, will likely be of little gain for the extra code added. Though its of (relatively) little cost too. Anyway, point 5 may be considered not worth to be applied. Hence its an extra commit (and the last one in the MR, so easy to omit).