proposal: private module-level import for faster compilation

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 20 11:51:49 PDT 2016


On Wednesday, 20 July 2016 at 18:21:46 UTC, ketmar wrote:
> p.s. the sole improvement in symbol lookup mechanics can speed 
> up the things by several factors, and without breaking the 
> language. current dmdfe symbol/template lookup mechanics is not 
> really fast.

If this example weren't enough, here's the other even more 
compelling argument: speedup up recompilation for makefile-like 
tools that trigger recompilation when a dependency is modified:

---
module fun1;
import fun2;
void test1(){}
---
module fun2;
version(A) import std.datetime;
//version(proposed_feature) private import std.datetime;
void test2(){}
---

dmd -c -o- -version=proposed_feature -deps fun1.d
would show following dependencies:
fun2

dmd -c -o- -version=A -deps fun1.d
shows following 68 dependencies (68!)

That means that a change in any single dependency would trigger 
recompilations in many files.

fun2 core.attribute core.bitop core.exception 
core.internal.string core.internal.traits core.memory 
core.stdc.config core.stdc.errno core.stdc.inttypes 
core.stdc.signal core.stdc.stdarg core.stdc.stddef 
core.stdc.stdint core.stdc.stdio core.stdc.stdlib 
core.stdc.string core.stdc.time core.stdc.wchar_ 
core.sys.osx.mach.kern_return core.sys.posix.config 
core.sys.posix.dirent core.sys.posix.fcntl 
core.sys.posix.inttypes core.sys.posix.signal 
core.sys.posix.stdlib core.sys.posix.sys.select 
core.sys.posix.sys.stat core.sys.posix.sys.time 
core.sys.posix.sys.types core.sys.posix.sys.wait 
core.sys.posix.time core.sys.posix.unistd core.sys.posix.utime 
core.time core.vararg object std.algorithm 
std.algorithm.comparison std.algorithm.iteration 
std.algorithm.mutation std.algorithm.searching 
std.algorithm.setops std.algorithm.sorting std.array std.ascii 
std.bitmanip std.conv std.datetime std.exception std.file 
std.format std.functional std.internal.cstring 
std.internal.unicode_tables std.meta std.path std.range 
std.range.interfaces std.range.primitives std.stdio std.stdiobase 
std.string std.system std.traits std.typecons std.typetuple 
std.uni



More information about the Digitalmars-d mailing list