DIP10005: Dependency-Carrying Declarations is now available for community feedback
Andrei Alexandrescu via Digitalmars-d
digitalmars-d at puremagic.com
Sat Dec 24 01:34:03 PST 2016
On 12/23/2016 09:23 PM, Chris Wright wrote:
[abbreviated below]
Upon more investigation, I see a large discrepancy between the findings
of DIP1005 and yours. So there are a number of claims here, which I'll
summarize:
> tldr: the performance impact of this DIP would be too small to easily
> measure and only impacts 26 declarations referencing 14 templates in the
> standard library anyway.
> Phobos has 26 templates that would use this special syntax, referencing
> 14 distinct templates and CTFE functions in three modules.
> The templates that have to be parsed are std.traits, std.meta, and
> std.range.primitives. I wrote a test program that imported them without
> using them. It compiled in too little time to accurately measure --
> `time` reports 0.01s wall time.
>
> You want to add new language syntax to save me ten milliseconds during
> compilation.
The findings of DIP1005 are the following:
* Importing a single std module also imports on average 10.5 other modules.
* Importing a single std module costs on average 64.6 ms.
* (Not stated in the DIP) A majority of std templates would acquire
inline imports.
According to the DIP, one may estimate that the proposed feature would
reduce additional imports to 0 and the average time to import a single
module by a factor of 10 to under 10 ms.
By your estimates:
* 26 templates in std need inline imports.
* Importing a single std module today would only imports 1-3 other
modules most of the time (one or more of std.traits, std.meta, and
std.range.primitives).
* These additional imports cost in aggregate under 10ms, bringing the
average cost of importing a module itself to 54.6 ms.
* It follows that the average module takes 5.46 more times to import
alone than the sum of std.traits, std.meta, and std.range.primitives
(which have a total of 11263 lines, 5x more than the average Phobos module).
I don't see how your claims can be simultaneously true with the findings
of DIP1005. The scripts that compute those numbers are available with
the DIP. Were you able to reproduce them?
(I confirm that importing std.traits, std.meta, and std.range.primitives
together takes 10ms.)
Thanks,
Andrei
More information about the Digitalmars-d
mailing list