mirror of
https://github.com/catchorg/Catch2.git
synced 2026-08-23 22:03:41 +02:00
The previous approach was for `add_command` to behave as append function via concatenating the command string internally and then saving it into `PARENT_SCOPE`. Because this in practice ended up meaning concatenating a copy of the string inside the function and then overwriting the string outside the function, the performance was lacking. The new approach is for `prepare_command` to only escape & return the command from single call, and the caller is responsible for concatenating the result. Since the actual concatenation no longer crosses function scope boundaries, the performance is much better, even though the scaling is still quadratic. The new approach only takes 1/4-1/5 of the time, saving ~1s at 1k tests, 4.5s at 2k tests and 19s at 4k tests.