digitalmars.D - Big executable?
- Andre Tampubolon (12/12) Oct 05 2010 Hi,
- Kagamin (2/10) Oct 05 2010 300kb is the lower limit if you use phobos and druntime.
- so (11/21) Oct 06 2010 First response (and yet not actually an answer) to a newcomer is from a ...
- Jonathan M Davis (7/31) Oct 06 2010 I'm not sure if there have been any bugs reported on large executable si...
- bearophile (4/5) Oct 06 2010 http://d.puremagic.com/issues/show_bug.cgi?id=2254
- Jonathan M Davis (9/25) Oct 06 2010 People complain about that from time to time, and I believe that some wo...
- Andre Tampubolon (2/27) Oct 06 2010 OK. Thanks for the input. I can live with that :)
- Jacob Carlborg (7/19) Oct 06 2010 You are aware of that C is (almost always) dynamically linked with the
- so (5/26) Oct 06 2010 Which is the next thing Walter will be working on after this 64bit
- Walter Bright (3/12) Oct 06 2010 Yes, making Phobos a shared library rather than statically linking it wi...
- Jacob Carlborg (6/18) Oct 07 2010 Of course when Phobos is a dynamic library you would probably need to
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (18/30) Oct 06 2010 A better size comparison would be with C++ and a static libstdc++:
- Kagamin (2/6) Oct 07 2010 In fact, I don't see a problem in 300kb exe size. This time I didn't hav...
- Justin Johansson (8/20) Oct 07 2010 Try assembly language. Your executable will be less than 256 bytes
- Juanjo Alvarez (3/6) Oct 07 2010 46 bytes on Linux, using serious hackery; interesting & funny read:
- Andrej Mitrovic (6/18) Oct 14 2010 I had an odd thing going while coding a D app. It only had a few
Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.
Oct 05 2010
Andre Tampubolon Wrote:import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge,300kb is the lower limit if you use phobos and druntime.
Oct 05 2010
On Wed, 06 Oct 2010 09:36:00 +0300, Kagamin <spam here.lot> wrote:Andre Tampubolon Wrote:First response (and yet not actually an answer) to a newcomer is from a phobos hater, isn't it grand! Anyways, there are not much of reasons that should make D produce bigger executables than other system languages. I remember, just recently Andrei fixed something in phobos that affects exe size. It is getting better but as far as i can gather from this newsgroup it is a low priority (bug?). -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge,300kb is the lower limit if you use phobos and druntime.
Oct 06 2010
On Wednesday 06 October 2010 00:11:05 so wrote:On Wed, 06 Oct 2010 09:36:00 +0300, Kagamin <spam here.lot> wrote:I'm not sure if there have been any bugs reported on large executable sizes or not. But I believe that the Phobos developers are far more interested in improving the functionality of Phobos than they are in reducing the resulting executable size. They may very well want to do some work to reduce it, but it's bound to be a lower priority than functionality unless it's really bad. - Jonathan M DavisAndre Tampubolon Wrote:First response (and yet not actually an answer) to a newcomer is from a phobos hater, isn't it grand! Anyways, there are not much of reasons that should make D produce bigger executables than other system languages. I remember, just recently Andrei fixed something in phobos that affects exe size. It is getting better but as far as i can gather from this newsgroup it is a low priority (bug?).import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge,300kb is the lower limit if you use phobos and druntime.
Oct 06 2010
Jonathan M Davis:I'm not sure if there have been any bugs reported on large executable sizes or not.http://d.puremagic.com/issues/show_bug.cgi?id=2254 Bye, bearophile
Oct 06 2010
On Tuesday 05 October 2010 23:12:08 Andre Tampubolon wrote:Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.People complain about that from time to time, and I believe that some work has been done to reduce the executable size, but the reality of the manner is that the plumbing that comes with druntime and the GC is going to take up some space, even if you don't use much of it. However, it will likely get dwarfed by the rest of your code if you write a decent size program, so it really won't matter much with real programs. It's just that the minimum size is a bit larger than some would like. - Jonathan M Davis
Oct 06 2010
On 10/6/2010 2:14 PM, Jonathan M Davis wrote:On Tuesday 05 October 2010 23:12:08 Andre Tampubolon wrote:OK. Thanks for the input. I can live with that :)Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.People complain about that from time to time, and I believe that some work has been done to reduce the executable size, but the reality of the manner is that the plumbing that comes with druntime and the GC is going to take up some space, even if you don't use much of it. However, it will likely get dwarfed by the rest of your code if you write a decent size program, so it really won't matter much with real programs. It's just that the minimum size is a bit larger than some would like. - Jonathan M Davis
Oct 06 2010
On 2010-10-06 08:12, Andre Tampubolon wrote:Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly. -- /Jacob Carlborg
Oct 06 2010
On Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:On 2010-10-06 08:12, Andre Tampubolon wrote:Which is the next thing Walter will be working on after this 64bit business. -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.
Oct 06 2010
so wrote:On Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:Yes, making Phobos a shared library rather than statically linking it will pretty much resolve this problem.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.Which is the next thing Walter will be working on after this 64bit business.
Oct 06 2010
On 2010-10-06 20:01, Walter Bright wrote:so wrote:Of course when Phobos is a dynamic library you would probably need to distributed it as well and then you will have same size again or even larger. -- /Jacob CarlborgOn Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:Yes, making Phobos a shared library rather than statically linking it will pretty much resolve this problem.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.Which is the next thing Walter will be working on after this 64bit business.
Oct 07 2010
On Thu, 07 Oct 2010 11:39:41 +0300, Jacob Carlborg <doob me.com> wrote:On 2010-10-06 20:01, Walter Bright wrote:Eh? -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/so wrote:Of course when Phobos is a dynamic library you would probably need to distributed it as well and then you will have same size again or even larger.On Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:Yes, making Phobos a shared library rather than statically linking it will pretty much resolve this problem.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.Which is the next thing Walter will be working on after this 64bit business.
Oct 07 2010
Thu, 07 Oct 2010 13:27:23 +0300, so wrote:On Thu, 07 Oct 2010 11:39:41 +0300, Jacob Carlborg <doob me.com> wrote:If the DMD/Phobos distribution doesn't provide compatible API/ABI between DMD/Phobos versions, the dynamic library has very little use since all libraries need to be distributed with the 3rd party application.On 2010-10-06 20:01, Walter Bright wrote:Eh?so wrote:Of course when Phobos is a dynamic library you would probably need to distributed it as well and then you will have same size again or even larger.On Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:Yes, making Phobos a shared library rather than statically linking it will pretty much resolve this problem.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.Which is the next thing Walter will be working on after this 64bit business.
Oct 07 2010
On Thu, 07 Oct 2010 13:41:26 +0300, retard <re tard.com.invalid> wrote:Thu, 07 Oct 2010 13:27:23 +0300, so wrote:If we want to distribute a single shared library, until things get settled there is nothing we can do. Also we are not talking about a single exec per project right? If this is what you mean, yes i agree it has no use, but if in your project you got more than one executable or shared library it is a gain. We all know how shared libraries work right? -- Using Opera's revolutionary e-mail client: http://www.opera.com/mail/On Thu, 07 Oct 2010 11:39:41 +0300, Jacob Carlborg <doob me.com> wrote:If the DMD/Phobos distribution doesn't provide compatible API/ABI between DMD/Phobos versions, the dynamic library has very little use since all libraries need to be distributed with the 3rd party application.On 2010-10-06 20:01, Walter Bright wrote:Eh?so wrote:Of course when Phobos is a dynamic library you would probably need to distributed it as well and then you will have same size again or even larger.On Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:Yes, making Phobos a shared library rather than statically linking it will pretty much resolve this problem.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.Which is the next thing Walter will be working on after this 64bit business.
Oct 07 2010
Thu, 07 Oct 2010 14:08:17 +0300, so wrote:On Thu, 07 Oct 2010 13:41:26 +0300, retard <re tard.com.invalid> wrote:Yes, that's a fair point.Thu, 07 Oct 2010 13:27:23 +0300, so wrote:If we want to distribute a single shared library, until things get settled there is nothing we can do. Also we are not talking about a single exec per project right? If this is what you mean, yes i agree it has no use, but if in your project you got more than one executable or shared library it is a gain.On Thu, 07 Oct 2010 11:39:41 +0300, Jacob Carlborg <doob me.com> wrote:If the DMD/Phobos distribution doesn't provide compatible API/ABI between DMD/Phobos versions, the dynamic library has very little use since all libraries need to be distributed with the 3rd party application.On 2010-10-06 20:01, Walter Bright wrote:Eh?so wrote:Of course when Phobos is a dynamic library you would probably need to distributed it as well and then you will have same size again or even larger.On Wed, 06 Oct 2010 10:40:11 +0300, Jacob Carlborg <doob me.com> wrote:Yes, making Phobos a shared library rather than statically linking it will pretty much resolve this problem.You are aware of that C is (almost always) dynamically linked with the standard and runtime library but D (usually) is not? Using D1 and Tango on Mac OS X (which supports dynamic linking of the standard library) gives an executable of the size 16 KB if I recall correctly.Which is the next thing Walter will be working on after this 64bit business.We all know how shared libraries work right?Sorry for that. The answer was directed more towards the original poster.
Oct 07 2010
Andre Tampubolon wrote:I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.A better size comparison would be with C++ and a static libstdc++: ln -s `g++ -print-file-name=libstdc++.a` g++ -O2 -o hello-cxx -static-libgcc -L. hello.cpp Using GDC instead, no 64-bit DMD (avoiding libgcc_s.so, to compare): gdc -O2 -frelease -o hello-d -static-libgcc hello.d 540K hello-cxx 312K hello-d And yes it is big, for the trivial example. gcc -O2 -o hello-c hello.c 12K hello-c 4,0K hello.sh --anders PS. Static libgcc isn't really a good idea as it breaks exceptions. It was more for the size comparisons. A dynamic Phobos would "fix". And yes, those were the sizes without the debugging symbols. Except that the shell script really was 30 bytes... "strip -S", "du -h".
Oct 06 2010
so Wrote:In fact, I don't see a problem in 300kb exe size. This time I didn't have hate in mind, I just checked my executables' size and figured out the answer. I don't know, what is responsible for this big size, though it doesn't seem to be C runtime.300kb is the lower limit if you use phobos and druntime.First response (and yet not actually an answer) to a newcomer is from a phobos hater, isn't it grand!
Oct 07 2010
On 6/10/2010 5:12 PM, Andre Tampubolon wrote:Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.Try assembly language. Your executable will be less than 256 bytes (perhaps on legacy operating systems, and, of course, using the O/S to make a call to write to stdout). Naturally YMMV depending on the language translator that you use, and, as you have appropriately noted, your mileage experience is not climate-change friendly. -- Justin
Oct 07 2010
Justin Johansson Wrote:Naturally YMMV depending on the language translator that you use, and, as you have appropriately noted, your mileage experience is not climate-change friendly.46 bytes on Linux, using serious hackery; interesting & funny read: http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
Oct 07 2010
I had an odd thing going while coding a D app. It only had a few thousand lines of code, but at some point the more code I added the executable would get smaller, until I would add even more code and then it would finally expand again. I guess this has something to do with DMD optimizations. On 10/6/10, Andre Tampubolon <andre lc.vlsm.org> wrote:Hi, I just started learning D (my background is C, anyway). I compiled this simple code using DMD 2.049 (dmd -O -release test1.d) : import std.stdio; void main() { writefln("%s World", "Hello"); } The final executable size is about 300 KB. Isn't that a bit huge, considering the same code compiled using C or Pascal compiler will give smaller executable? So I tried to look at the *.map, and apparently the D runtime pulls a lot of stuff. I am just wondering, anyway.
Oct 14 2010