teething troubles
Hi all, I need a little helping hand with dmd on a 32 bit Debian box. I installed dmd from http://d-apt.sourceforge.net/ i) First trial: $cat test.d import std.stdio; void main() { writeln(hello); } $ time dmd test.d real0m2.355s user0m1.652s sys 0m0.364s $./test hello $ dmd -v test.d | wc -l 84 Seems to be working. My only concern is whether 2.35s for compiling such a trivial file is normal. ii) 2nd trial == I installed gdc. Now I get $ time gdc test.d real0m6.286s user0m3.856s sys 0m0.884s == Given the dmd and gdc timings, it seems I am doing something wrong. iii) 3rd trial I installed tango from http://d-apt.sourceforge.net/ I know this can ruffle feathers. Please assume good faith. I am just trying to learn from the tango book. === $ls /usr/include/dmd/tango core io math net stdc sys text time util $cat test.d import tango.io.Stdout; void main() { Stdout (hello).newline; } $dmd -I/usr/include/dmd/tango -v test.d binarydmd version v2.065 config/etc/dmd.conf parse test importall test importobject (/usr/include/dmd/druntime/import/object.di) importtango.io.Stdout (tango/io/Stdout.d) test.d(1): Error: module Stdout is in file 'tango/io/Stdout.d' which cannot be read import path[0] = /usr/include/dmd/tango import path[1] = /usr/include/dmd/phobos import path[2] = /usr/include/dmd/druntime/import It seems inspite of specifying usr/include/dmd/tango it cannot import tango.io.Stdout. Here is my /etc/dmd.conf [Environment32] DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -L-L/usr/lib/i386-linux-gnu -L--export-dynamics What am I doing wrong. Thanks for the help. -- Dean
Re: teething troubles
Dean: I need a little helping hand with dmd on a 32 bit Debian box. I installed dmd from http://d-apt.sourceforge.net/ i) First trial: $cat test.d import std.stdio; void main() { writeln(hello); } $ time dmd test.d real0m2.355s user0m1.652s sys 0m0.364s $./test hello $ dmd -v test.d | wc -l 84 Seems to be working. My only concern is whether 2.35s for compiling such a trivial file is normal. On a Windows 32 bit that little program compiles in 0.74 seconds (warmed up time) using and old CPU. Modern CPUs should take about 0.5 seconds. Keep in mind that writeln and std.stdio are lot of stuff. If you use C io functions: void main() { import core.stdc.stdio; puts(hello); } This compiles in 0.18 seconds (warmed up time) on the same computer with dmd. The difference between 0.74 and 0.18 is more or less a constant if you use std.stdio. I have also tried this C++ version: #include iostream int main() { std::cout hello std::endl; return 0; } With gcc 4.8.0 it takes me 0.48 seconds to compile (warmed up time). Writeln manages unicode, and is quite more refined than iostream. Bye, bearophile
Re: teething troubles
On a Windows 32 bit that little program compiles in 0.74 seconds (warmed up time) using and old CPU. Modern CPUs should take about 0.5 seconds. Thanks for checking the timings wait I am not alone in using a 32 bit box ! Mine is an Athlon 1045.456 MHz. The minimum of 3 consecutive compilation runs that I get is 2.3 seconds. Keep in mind that writeln and std.stdio are lot of stuff. Just to be clear I am not complaining dmd is slow. I am just concerned that I am doing something wrong. I have also tried this C++ version: #include iostream int main() { std::cout hello std::endl; return 0; } With gcc 4.8.0 it takes me 0.48 seconds to compile (warmed up time). On my box this compiles in 1.2 seconds. So it seems somewhat consistent (as in 3 times slower for both). I got worried because I expected dmd to compile hello world substantially faster than g++. I have heard that dmd is instantaneous. I am still at a loss about tango for D2 problem. Shouldnt providing the -I option with the path to tango work. Does any other magic need to happen. I dont know the internal mechanics of importing modules.
Re: teething troubles
Dean: Mine is an Athlon 1045.456 MHz. The minimum of 3 consecutive compilation runs that I get is 2.3 seconds. Then I think your timings could be OK, I am using an old 2.3 GHz CPU. On my box this compiles in 1.2 seconds. So it seems somewhat consistent (as in 3 times slower for both). OK. I got worried because I expected dmd to compile hello world substantially faster than g++. I have heard that dmd is instantaneous. dmd compiles very quickly, but to compile writeln D has to digest a good amount of Phobos code. So you will not see a much larger compilation time if you compile small D programs. I am still at a loss about tango for D2 problem. I think I've never used Tango with dmd. Bye, bearophile
Re: teething troubles
On Thursday, 17 July 2014 at 09:32:24 UTC, bearophile wrote: Dean: Mine is an Athlon 1045.456 MHz. Didn't notice that before hitting send. compilation runs that I get is 2.3 seconds. Then I think your timings could be OK, I am using an old 2.3 GHz CPU. Glad to know that I am not doing something stupid, yet. dmd compiles very quickly, but to compile writeln D has to digest a good amount of Phobos code. Are the reasons for this similar to why C++ STL is not an object code library ? I am still at a loss about tango for D2 problem. I think I've never used Tango with dmd. Not even sure if its a tango problem. Dmd doesn't seem to be picking up the path that I specify with -I. Perhaps the mechanics of module loading is not as simple as I imagine. I initially thought its a permission problem, but that is not the case.
Re: teething troubles
Dean: dmd compiles very quickly, but to compile writeln D has to digest a good amount of Phobos code. Are the reasons for this similar to why C++ STL is not an object code library ? The reasons for the large amount of code compiled for a writeln are that: writeln is more powerful, Phobos modules import each other a lot. And several parts of Phobos are not compiled because there are templates everywhere. Take a look at Phobos sources and you will see. Bye, bearophile
Re: teething troubles
On Thursday, 17 July 2014 at 10:13:46 UTC, bearophile wrote: Dean: dmd compiles very quickly, but to compile writeln D has to digest a good amount of Phobos code. Are the reasons for this similar to why C++ STL is not an object code library ? The reasons for the large amount of code compiled for a writeln are that: writeln is more powerful, Phobos modules import each other a lot. And several parts of Phobos are not compiled because there are templates everywhere. Take a look at Phobos sources and you will see. Bye, bearophile Apologies, I wasnt clear. I was talking about the reason behind compiling the code from source as opposed to linking precompiled objects. I was speculating wether the reasons are similar to that of STL, i.e. specializing to the type as late as possible.
Re: teething troubles
On 7/17/2014 7:01 PM, Dean wrote: Not even sure if its a tango problem. Dmd doesn't seem to be picking up the path that I specify with -I. Perhaps the mechanics of module loading is not as simple as I imagine. I initially thought its a permission problem, but that is not the case. What does your tango source tree look like? Is it a) or b)? a) /usr/include/dmd/tango/io/Stdout.d b) /usr/include/dmd/tango/tango/io/Stdout.d When you pass -I/usr/include/dmd/tango, then it needs to look like b). If it's a), then you should pass -I/usr/include/dmd. The reason is that 'tango' is the top-level package directory. Its *parent* directory needs to be on the import path. --- This email is free from viruses and malware because avast! Antivirus protection is active. http://www.avast.com
Re: teething troubles
On Thursday, 17 July 2014 at 11:08:16 UTC, Mike Parker wrote: On 7/17/2014 7:01 PM, Dean wrote: Not even sure if its a tango problem. Dmd doesn't seem to be picking up the path that I specify with -I. Perhaps the mechanics of module loading is not as simple as I imagine. I initially thought its a permission problem, but that is not the case. What does your tango source tree look like? Is it a) or b)? a) /usr/include/dmd/tango/io/Stdout.d b) /usr/include/dmd/tango/tango/io/Stdout.d When you pass -I/usr/include/dmd/tango, then it needs to look like b). If it's a), then you should pass -I/usr/include/dmd. The reason is that 'tango' is the top-level package directory. Its *parent* directory needs to be on the import path. Hi Mike, that was it. Thanks a lot.