rdmd takes 2-3 seconds on a first-run of a simple .d script
BoQsc
vaidas.boqsc at gmail.com
Tue May 28 08:48:53 UTC 2019
On Tuesday, 28 May 2019 at 06:06:24 UTC, Seb wrote:
> On Tuesday, 28 May 2019 at 05:11:15 UTC, Andre Pany wrote:
>> On Monday, 27 May 2019 at 07:16:37 UTC, BoQsc wrote:
>>> [...]
>>
>> I can confirm, without measuring the exact timing, "dmd -run
>> test.d" feels much
>> faster than "rdmd test.d". I would say 1 second instead of 2
>> seconds.
>>
>> Kind regards
>> André
>
> Well, that's because rdmd is an old legacy tool that runs the
> compiler twice.
> Use dmd -i or rund (https://github.com/dragon-lang/rund).
FOR WINDOWS OPERATING SYSTEMS ONLY
Since I run simple D scripts a lot of time, as an experiment I
molded a registry tweak that associate .d files with dmd
compiler, with those options in combination:
http://dlang.k3.1azy.net/dmd-windows.html#switch-i[
http://dlang.k3.1azy.net/dmd-windows.html#switch-run
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Applications\dmd.exe\shell\open\command]
@="\"C:\\D\\dmd2\\windows\\bin\\dmd.exe\" \"-i\" \"-run\" \"%1\""
What this Registry Tweak does:
Adds file association for .d file type, so that you can run a .d
file by
double clicking .d file.
To use it:
1. create a simple empty text file
2. change its file extension from .txt to .reg
3. copy the above registry instructions into previously created
file.
4. double click this newly created .reg file.
5. confirm that you want to apply these registry changes.
Downsides I experienced by using dmd -i and -run switches:
.obj and .exe file can be seen generated in the same folder as .d
file script, while
dmd is running your script.
However, they are deleted after the .d script is finished running
uninterupted.
If dmd is interupted while processing .d script - by being
terminated, .obj and .exe files might be left undeleted.
More information about the Digitalmars-d-learn
mailing list