www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Executable Size

reply Gambler <Gambler_member pathlink.com> writes:
I just compiled my firts D program. It is the word count program from some
exapme on this website. Executable is 80kb. WC program in C is 20kb. My question
is, is such situation common with D? Or is it just std.file library?
May 17 2006
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Gambler wrote:

 I just compiled my firts D program. It is the word count program from some
 exapme on this website. Executable is 80kb. WC program in C is 20kb. My
question
 is, is such situation common with D? Or is it just std.file library?
Looks normal... Some reasons are: 1) the code for garbage collection 2) the static linking of Phobos lib C++ also tends to be a bit larger than C. (*especially* if you include the std lib) Is the code size for D really a problem ? --anders PS. For a sample I got: 12K hello_c 156K hello_d 368K hello_cpp With GDC on Mac OS X.
May 17 2006
prev sibling next sibling parent reply "Unknown W. Brackets" <unknown simplemachines.org> writes:
Because of the gc, std.file and such, you do get a penalty initially.

This has been discussed in the past and it's been shown that, generally, 
D scales better as you add more code - e.g. its fixed costs are higher 
but the variable costs are lower.

Either way, for a non-trivial (or even semi-trivial) program, I doubt 
it'd be a major issue.

-[Unknown]


 I just compiled my firts D program. It is the word count program from some
 exapme on this website. Executable is 80kb. WC program in C is 20kb. My
question
 is, is such situation common with D? Or is it just std.file library?
 
 
May 17 2006
parent Gambler <Gambler_member pathlink.com> writes:
Because of the gc, std.file and such, you do get a penalty initially.

This has been discussed in the past and it's been shown that, generally, 
D scales better as you add more code - e.g. its fixed costs are higher 
but the variable costs are lower.
Okay, that's a good thing to hear. Thanks for replies.
May 18 2006
prev sibling parent Niko Korhonen <niktheblak hotmail.com> writes:
Gambler wrote:
 I just compiled my firts D program. It is the word count program from some
 exapme on this website. Executable is 80kb. WC program in C is 20kb. My
question
 is, is such situation common with D? Or is it just std.file library?
Oh please. When I compile a C++ program with GCC the executable size is at least several hundred kilobytes. When I compile a Haskell program, it's at least one megabyte and more if I use any external libraries. In a Scala program I need to distribute 1.5 MB runtime library along the runtime libraries and instruct the client to install those into their GAC. So I think D fares /very/ well in this regard. -- Niko Korhonen SW Developer
May 17 2006