what are guidelines for when to split a module into a package?
Seb
seb at wilzba.ch
Thu Feb 22 08:15:01 UTC 2018
On Thursday, 22 February 2018 at 08:04:19 UTC, Timothee Cour
wrote:
>> it actually does reduce compilation times if the imports go
>> directly to the module in
> question rather than to a module that publicly imports the
> symbols
>
> time1=compilation time of `import std.algorithm : find;` before
> split time21=compilation time of `import std.algorithm : find;`
> after split time22=compilation time of `import
> std.algorithm.searching : find;` after split
>
> my understand is that we have:
> time22 < time1 but time21 ~= time1
> so we're in no way worse than before the split
> unless time21 > time1 (noticably) in which case you have a
> strong argument
>
>
> On Wed, Feb 21, 2018 at 11:57 PM, Jonathan M Davis via
> Digitalmars-d <digitalmars-d at puremagic.com> wrote:
>> On Wednesday, February 21, 2018 23:48:32 Timothee Cour via
>> Digitalmars-d wrote:
>>> ```
>>> import std.algorithm.searching : find;
>>>
>>> not
>>>
>>> import std.algorithm : find;
>>> ```
>>>
>>> that's just a missed opportunity to benefit from the split;
>>> we're in no way worse after the split than before the split
>>> in that regard. We can just leave it as `import std.algorithm
>>> : find;` with no adverse effect.
>>
>> Maybe, but the CI stuff for Phobos doesn't like that, and it
>> actually does reduce compilation times if the imports go
>> directly to the module in question rather than to a module
>> that publicly imports the symbols.
>>
>> - Jonathan M Davis
Regarding import time:
Apart from the fact that you usually end up importing almost
entire Phobos anyways, the import cost for importing entire
Phobos is about 0.2s on my system with the upcoming 2.079 and we
are working on getting it even further towards 0 which shouldn't
be too hard (there's still a lot of unnecessary work being done
by default).
I'm really looking forward to the point where we can just tell
people to use `import std;` because there's almost no overhead.
(I am aware that there are downsides to importing everything but
that's not what this discussion is about)
More information about the Digitalmars-d
mailing list