A recent pull request:
https://github.com/D-Programming-Language/dmd/pull/4704
reduces memory consumed by parsing unittest blocks that are subsequently ignored. A further refinement to that suggested by Andrei was to switch to a specialized grammar for it, that only recognizes:
. {
. }
. comments
. string literals
. anything else
so it can lex much faster, i.e. it won't need to enter identifiers into the stringtable or convert integer literals to integers.
The idea is we wish to encourage extensive unit tests, but not punish users for having them with slower compile times.
Comment #1 by robert.schadek — 2024-12-13T18:43:06Z