Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-28 Thread Andre Pany via Digitalmars-d-learn

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).


When I do remember correctly the shebang line has some issue with 
arguments.

#!/usr/bin/env rdmd

Just an idea: Instead of removing rdmd, it could be an "alias" to 
"dmd -i -run"?


Kind regards
André


Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-28 Thread BoQsc via Digitalmars-d-learn

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.


Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-27 Thread Seb via Digitalmars-d-learn

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).


Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-27 Thread Andre Pany via Digitalmars-d-learn

On Monday, 27 May 2019 at 07:16:37 UTC, BoQsc wrote:

On Sunday, 26 May 2019 at 20:37:36 UTC, Jon Degenhardt wrote:

[...]


The desktop computer I'm testing this on contains Solid State 
Drive, a Windows 10 Home Operating system and about 7-9 years 
old of hardware. But remember, we are living in a 21 century, 
the hardware performance is great, even for the old hardware 
that is 10 years old, especially the desktops.


I tried to disable Windows Defender real-time protection, it 
didn't helped to speed up rdmd. However until I test it on 
Linux, I can't be sure if Windows do not have other less 
obvious quirks that could slow down third party programs such 
as D compiler or rdmd.


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é


Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-27 Thread BoQsc via Digitalmars-d-learn

On Sunday, 26 May 2019 at 20:37:36 UTC, Jon Degenhardt wrote:

On Saturday, 25 May 2019 at 22:18:16 UTC, Andre Pany wrote:

On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote:
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.


Also please keep in mind there could be other factors like 
slow disks, anti virus scanners,... which causes a slow down.


I have seen similar behavior that I attribute to virus scan 
software. After compiling a program, the first run takes 
several seconds to run, after that it runs immediately. I'm 
assuming the first run of an unknown binary triggers a scan, 
though I cannot be completely sure.


Try compiling a new binary in D or C++ and see if a similar 
effect is seen.


--Jon


The desktop computer I'm testing this on contains Solid State 
Drive, a Windows 10 Home Operating system and about 7-9 years old 
of hardware. But remember, we are living in a 21 century, the 
hardware performance is great, even for the old hardware that is 
10 years old, especially the desktops.


I tried to disable Windows Defender real-time protection, it 
didn't helped to speed up rdmd. However until I test it on Linux, 
I can't be sure if Windows do not have other less obvious quirks 
that could slow down third party programs such as D compiler or 
rdmd.


Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-26 Thread Jon Degenhardt via Digitalmars-d-learn

On Saturday, 25 May 2019 at 22:18:16 UTC, Andre Pany wrote:

On Saturday, 25 May 2019 at 08:32:08 UTC, BoQsc wrote:
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.


Also please keep in mind there could be other factors like slow 
disks, anti virus scanners,... which causes a slow down.


I have seen similar behavior that I attribute to virus scan 
software. After compiling a program, the first run takes several 
seconds to run, after that it runs immediately. I'm assuming the 
first run of an unknown binary triggers a scan, though I cannot 
be completely sure.


Try compiling a new binary in D or C++ and see if a similar 
effect is seen.


--Jon



Re: rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-25 Thread Andre Pany via Digitalmars-d-learn

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


rdmd takes 2-3 seconds on a first-run of a simple .d script

2019-05-25 Thread BoQsc via Digitalmars-d-learn
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");

}