Bug 22435 – -unittest causes all template instances to be emitted
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-10-25T16:46:39Z
Last change time
2022-07-29T14:26:05Z
Assigned to
No Owner
Creator
Atila Neves
Comments
Comment #0 by atila.neves — 2021-10-25T16:46:39Z
With a file that's only one line: `import std.uni;`, it takes 4x longer to compile with -unittest than not. The reason is that `needsCodegen` always (in essence, in practice it's slightly more complicated) returns true when -unittest is passed even for non-root modules, and importing Phobos means generating code for all of them.