rdmd takes 2-3 seconds on a first-run of a simple .d script
Andre Pany
andre at s-e-a-p.de
Sat May 25 22:18:16 UTC 2019
On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote:
>> rdmd is a companion to the dmd compiler that simplifies the
>> typical edit-compile-link-run or edit-make-run cycle to a
>> rapid edit-run cycle. Like make and other tools, rdmd uses the
>> relative dates of the files involved to minimize the amount of
>> work necessary. Unlike make, rdmd tracks dependencies and
>> freshness without requiring additional information from the
>> user.
>
>> Source: https://dlang.org/rdmd.html
>
> I have a simple standard .d script and I'm getting annoyed that
> it takes 2-3 seconds to run and see the results via rdmd.
>
> This might sound like insanely laughable time to be annoyed by,
> but it is a enough of a problem for me to make a Thread in a D
> lang Forum.
>
> Every time I make a change to a script it takes at least 2
> seconds on my computer for it to run, if you are beginner like
> me - you know it is not very pleasant to wait out that
> duration. I wonder if anything can be done about it, why it
> takes so "much" time, and why can't the results show up in a
> few milliseconds instead?
>
> #!/usr/bin/env rdmd
> import std.stdio, std.process;
>
> void main() {
>
> writeln("This writeln is taking long time ");
> executeShell("pause");
>
> }
If I remember correctly:
rdmd does one step in the compilation step twice and is therefore
slower than dmd.
Dmd was in the meantime enhanced to provide the same
functionality as rdmd.
I assume dmd -i -run myscript.d
If you have one file only, you do not need the -i argument.
Also please keep in mind there could be other factors like slow
disks, anti virus scanners,... which causes a slow down.
Dmd also allows you to just test the syntax of your source code
file without generating an executable.
Kind regards
Andre
More information about the Digitalmars-d-learn
mailing list