Commit a9f5f48
authored
std.typecons: Make Nullable.toString always a template (dlang#10767)
Because some overloads of Nullable!T.toString are not templates,
instantiating a Nullable!T also always instantiates formatValue!T, and
all of its dependencies.
For large type hierarchies, this can add a significant amount of
compilation overhead.
We can avoid this by making remaining overloads of Nullable!T.toString
templates as well, similar to Tuple.
Timings from internal motivating use case:
Before:
9.00user 1.38system 0:10.57elapsed 98%CPU (0avgtext+0avgdata 5851516maxresident)k
21968inputs+48144outputs (0major+1468687minor)pagefaults 0swaps
After:
5.11user 0.61system 0:05.75elapsed 99%CPU (0avgtext+0avgdata 2762392maxresident)k
0inputs+34528outputs (0major+685900minor)pagefaults 0swaps1 parent 479a382 commit a9f5f48
1 file changed
+4
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3836 | 3836 | | |
3837 | 3837 | | |
3838 | 3838 | | |
3839 | | - | |
| 3839 | + | |
3840 | 3840 | | |
3841 | 3841 | | |
3842 | 3842 | | |
3843 | 3843 | | |
3844 | | - | |
| 3844 | + | |
3845 | 3845 | | |
3846 | 3846 | | |
3847 | 3847 | | |
3848 | 3848 | | |
3849 | | - | |
| 3849 | + | |
3850 | 3850 | | |
3851 | 3851 | | |
3852 | 3852 | | |
3853 | 3853 | | |
3854 | | - | |
| 3854 | + | |
3855 | 3855 | | |
3856 | 3856 | | |
3857 | 3857 | | |
| |||
0 commit comments