digitalmars.D - why simple hello world binary is ~700KB
- Bedros Hanounik (8/8) Oct 04 2007 why when I compile this program under gdc I get 697KB of binary and when...
- BCS (5/19) Oct 04 2007 short version: D doesn't (yet) use shared objects for the stdlib, C does...
- Michael Gnail (3/26) Oct 05 2007 I got a near 110K 'hello,world' on my XP with D 1.015, will there any
- BCS (4/29) Oct 05 2007 IIRC that is a linker issue. Tango side steps it by putting next to noth...
- Gregor Richards (6/21) Oct 04 2007 As per usual, the person asking this has not stripped his binary. How do...
- Simen Haugen (7/11) Oct 05 2007 Is there a strip utility for dmd produced .exe files?
- Jarrett Billingsley (4/15) Oct 04 2007 What command line did you use?. Non-release builds can be significantly...
- Jascha Wetzel (8/9) Oct 05 2007 The comparison isn't quite fair, since the D executable contains a lot
why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) import std.stdio; int main () { writefln("Hello World!"); return 0; } how can I get small footprint binaries out of any D compiler? any difference between gdc and dmd?
Oct 04 2007
Reply to Bedros,why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) import std.stdio; int main () { writefln("Hello World!"); return 0; } how can I get small footprint binaries out of any D compiler? any difference between gdc and dmd?short version: D doesn't (yet) use shared objects for the stdlib, C does. At this point, that hello world has most of the stdlib in it. This issue has been brought up before and something will get done about it sooner or later.
Oct 04 2007
BCS wrote:Reply to Bedros,I got a near 110K 'hello,world' on my XP with D 1.015, will there any way to link only the used part of stdlib in future version?why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) import std.stdio; int main () { writefln("Hello World!"); return 0; } how can I get small footprint binaries out of any D compiler? any difference between gdc and dmd?short version: D doesn't (yet) use shared objects for the stdlib, C does. At this point, that hello world has most of the stdlib in it. This issue has been brought up before and something will get done about it sooner or later.
Oct 05 2007
Reply to Michael,BCS wrote:IIRC that is a linker issue. Tango side steps it by putting next to nothing in the lib and lets you compile just about everthing and then just link in the modules you use.Reply to Bedros,I got a near 110K 'hello,world' on my XP with D 1.015, will there any way to link only the used part of stdlib in future version?why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) import std.stdio; int main () { writefln("Hello World!"); return 0; } how can I get small footprint binaries out of any D compiler? any difference between gdc and dmd?short version: D doesn't (yet) use shared objects for the stdlib, C does. At this point, that hello world has most of the stdlib in it. This issue has been brought up before and something will get done about it sooner or later.
Oct 05 2007
Bedros Hanounik wrote:why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) import std.stdio; int main () { writefln("Hello World!"); return 0; } how can I get small footprint binaries out of any D compiler? any difference between gdc and dmd?As per usual, the person asking this has not stripped his binary. How do so many people continue to labor under the misconception that no extra info is added to the binary by default? Strip your binaries. - Gregor Richards
Oct 04 2007
"Gregor Richards" <Richards codu.org> wrote in message news:fe3opi$n0o$1 digitalmars.com...As per usual, the person asking this has not stripped his binary. How do so many people continue to labor under the misconception that no extra info is added to the binary by default? Strip your binaries.Is there a strip utility for dmd produced .exe files? If I try to use gnu strip i get "\temp\t.exe: File format not recognized" A test with dmd 1.021 makes hello world 113kb, and after upx 49kb. Of course, a simple C version is 16kb and 13kb after upx. I'd still prefer D over C :)
Oct 05 2007
"Bedros Hanounik" <2bedros NOSPAMgmail.com> wrote in message news:fe3itj$eks$1 digitalmars.com...why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020)) import std.stdio; int main () { writefln("Hello World!"); return 0; } how can I get small footprint binaries out of any D compiler? any difference between gdc and dmd?What command line did you use?. Non-release builds can be significantly larger than their release counterparts.
Oct 04 2007
Bedros Hanounik wrote:why when I compile this program under gdc I get 697KB of binary and when I compile similar C code in gcc I get 6.5KB (both under Linux (GCC) 4.1.2 20070214 ( (gdc 0.24, using dmd 1.020))The comparison isn't quite fair, since the D executable contains a lot more than the C exe does. To get a more realistic comparison, compile a C++ version (using iostream) with statically linked runtime and RTTI enabled. Using VC8 (default release settings, plus /MT for statically linked runtime) that results in an exe size of 108kb, which is comparable to the 113kb that DMD 1.021 produces.
Oct 05 2007