D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 22435 - -unittest causes all template instances to be emitted
Summary: -unittest causes all template instances to be emitted
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-10-25 16:46 UTC by Atila Neves
Modified: 2022-07-29 14:26 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Atila Neves 2021-10-25 16:46:39 UTC
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.
Comment 1 Atila Neves 2022-07-29 14:26:05 UTC
Fixed by https://github.com/dlang/dmd/pull/13224