Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rdmd should compile package at a time #428

Open
dlang-bugzilla-migration opened this issue Jan 9, 2021 · 0 comments
Open

rdmd should compile package at a time #428

dlang-bugzilla-migration opened this issue Jan 9, 2021 · 0 comments
Labels
Prio.3.Normal A bug that is neither a blocker nor a regression T.RDMD Issues that apply only to rdmd Type.Enhancement An improvement to an existing functionality

Comments

@dlang-bugzilla-migration

Transferred from: https://issues.dlang.org/show_bug.cgi?id=14654

User @andralex reported (2015-Jun-05 16:10:40):

rdmd builds the given file and all of its dependents in one shot. For large projects, this becomes problematic because of many files are built unnecessarily if one file is touched.

One emerging pattern is to build one package (= directory) at a time, Haskell/Rust style. That allows users to organize dependencies in a scalable manner.

rdmd would collect the dependency graph, "color" the files have been affected by the changed files since last build, and then carve the entire file set by directory. If at least one file has been colored in a directory, that directory needs to be rebuilt.

This is a high impact project because it would instantly improve the lot of all rdmd users, and scales rdmd up for larger builds.

User @CyberShadow responded (2015-Jun-06 16:16:41):

If we want to improve build times with rdmd, the best thing we can do is get rid of rdmd (and only leave it as a thin wrapper around dmd). This is because rdmd needs to run dmd -o- to get the dependency graph, and then run dmd again to actually build the program. This means that lexing, parsing, semantics - everything except code gen and linking - must happen twice. For template or mixin-heavy code, this nearly doubles compilation time.

User @andralex responded (2015-Jun-06 16:46:38):

(In reply to Vladimir Panteleev from comment 1)

If we want to improve build times with rdmd, the best thing we can do is get
rid of rdmd (and only leave it as a thin wrapper around dmd). This is
because rdmd needs to run dmd -o- to get the dependency graph, and then run
dmd again to actually build the program. This means that lexing, parsing,
semantics - everything except code gen and linking - must happen twice. For
template or mixin-heavy code, this nearly doubles compilation time.

This improvement stands.

User @CyberShadow responded (2015-Jun-06 16:48:24):

Yes, they are orthogonal. But:

  1. It is potentially higher-impact. Even with per-package compilation, DMD will still need to lex/parse/etc. ALL modules.

  2. Any improvements we make now to rdmd may be harder to migrate into dmd

User @andralex responded (2015-Jun-06 16:58:03):

(In reply to Vladimir Panteleev from comment 3)

Yes, they are orthogonal. But:

  1. It is potentially higher-impact. Even with per-package compilation, DMD
    will still need to lex/parse/etc. ALL modules.

It's almost surprising rdmd is so immensely useful, eh :o).

BTW there was work on collecting dependencies while actually building. One nice solution would be for dmd -v to generate a line at the end of imports to mean "done". Then rdmd can run dmd concurrently and terminate if no need to generate code.

  1. Any improvements we make now to rdmd may be harder to migrate into dmd

I see it as the polar opposite. Improvements in rdmd clarify what sort of primitives and interfaces we need for highly modular compilation.

User @aG0aep6G responded (2015-Jun-14 22:52:52):

I implemented an alternative mentioned in the forum discussion: Compile all outdated files, and only those, with one compiler invocation to multiple object files.

#170

@dlang-bugzilla-migration dlang-bugzilla-migration added Type.Enhancement An improvement to an existing functionality Prio.3.Normal A bug that is neither a blocker nor a regression T.RDMD Issues that apply only to rdmd labels Jan 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Prio.3.Normal A bug that is neither a blocker nor a regression T.RDMD Issues that apply only to rdmd Type.Enhancement An improvement to an existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant