Jump to page: 1 26  
Page
Thread overview
compiled code file size
Sep 20, 2013
Duke Normandin
Sep 20, 2013
Temtaime
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
Temtaime
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
Dicebot
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
Dicebot
Sep 20, 2013
Temtaime
Sep 20, 2013
Dicebot
Sep 20, 2013
Temtaime
Sep 20, 2013
Justin Whear
Sep 20, 2013
Gary Willoughby
Sep 24, 2013
Iain Buclaw
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
Temtaime
Sep 20, 2013
Duke Normandin
Sep 20, 2013
JohnnyK
Sep 20, 2013
Temtaime
Sep 20, 2013
Nick Sabalausky
Sep 20, 2013
Duke Normandin
Sep 20, 2013
bearophile
Sep 21, 2013
Nick Sabalausky
Sep 20, 2013
H. S. Teoh
Sep 21, 2013
Dicebot
Sep 21, 2013
Peter Alexander
Sep 21, 2013
Dicebot
Sep 21, 2013
deadalnix
Sep 21, 2013
Temtaime
Sep 21, 2013
Dicebot
Sep 21, 2013
Temtaime
Sep 21, 2013
Dicebot
Sep 21, 2013
Dicebot
Sep 21, 2013
Manu
Sep 23, 2013
Sean Kelly
Sep 21, 2013
Peter Alexander
Sep 21, 2013
Manu
Sep 20, 2013
Duke Normandin
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
H. S. Teoh
Sep 20, 2013
Duke Normandin
Sep 20, 2013
Dicebot
Sep 20, 2013
Duke Normandin
Sep 20, 2013
captaindet
Sep 20, 2013
Duke Normandin
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
JohnnyK
Sep 20, 2013
Adam D. Ruppe
Sep 20, 2013
JohnnyK
Sep 20, 2013
Duke Normandin
Sep 21, 2013
Vladimir Panteleev
Sep 23, 2013
H. S. Teoh
September 20, 2013
I'm re-visiting the D language. I've compared the file sizes of 2 executables - 1 is compiled C code using gcc; the other is D code using dmd.

helloWorld.d => helloWorld.exe = 146,972 bytes
ex1hello.c => ex1-hello.exe = 5,661 bytes

Why such a huge difference???

Duke
September 20, 2013
DMD likes the size.
When compiling, compiler may use GBs of RAM.
In resulting executable there is no dead/unused code elimination.
September 20, 2013
On Friday, 20 September 2013 at 16:35:40 UTC, Temtaime wrote:
> In resulting executable there is no dead/unused code elimination.

Not true.
September 20, 2013
On Fri, 20 Sep 2013 18:35:39 +0200, Temtaime wrote:

> DMD likes the size.
> When compiling, compiler may use GBs of RAM.
> In resulting executable there is no dead/unused code elimination.

http://imgur.com/W5AMy0P
September 20, 2013
Why? I have a large project.
If i replace main with "void main() {}" the size is still 26 MB in debug.
September 20, 2013
On Friday, 20 September 2013 at 16:20:34 UTC, Duke Normandin wrote:
> Why such a huge difference???

The D program carries its additional D runtime library code with it, whereas the C program only depends on libraries provided by the operating system, and thus it doesn't have to include it in the exe.
September 20, 2013
On Friday, 20 September 2013 at 16:20:34 UTC, Duke Normandin wrote:
> I'm re-visiting the D language. I've compared the file sizes of 2 executables - 1 is compiled C code using gcc; the other is D code using dmd.
>
> helloWorld.d => helloWorld.exe = 146,972 bytes
> ex1hello.c => ex1-hello.exe = 5,661 bytes
>
> Why such a huge difference???
>
> Duke

You are doing it wrong.
```
$ gcc hello.c; ls -lah a.out
-rwxr-xr-x 1 dicebot users 4.9K Sep 20 18:47 a.out
```
vs
```
$ gcc -static hello.c; ls -lah a.out
-rwxr-xr-x 1 dicebot users 717K Sep 20 18:48 a.out
```

(C standard library is dynamically linked by default)

So actual relative difference is about 2x - quite big but not as huge. It mostly comes from additional D runtime stuff.
September 20, 2013
C/C++ applications also carries on its runtime(mingwm10, msvc's redist, for example).
If compiled with static runtime, msvc's hello world application uses about 40 KB.
September 20, 2013
On Friday, 20 September 2013 at 16:44:30 UTC, Temtaime wrote:
> Why? I have a large project.
> If i replace main with "void main() {}" the size is still 26 MB in debug.

Could be due to things like static module constructors or typeinfos. There *are* problems with things getting intertwined and not being considered dead by the linker, but it does try.

The proof of it is hello world being 150 KB instead of the 6 MB or so it would be if it carried all of the dead code from phobos too.
September 20, 2013
On Friday, 20 September 2013 at 16:37:19 UTC, Adam D. Ruppe wrote:
> On Friday, 20 September 2013 at 16:35:40 UTC, Temtaime wrote:
>> In resulting executable there is no dead/unused code elimination.
>
> Not true.

Well, it is _mostly_ true. There is an elimination of unused code inside the function bodies during the code gen, but no unused data/code symbol elimination - and it actually can't be done safely right now by language design.
« First   ‹ Prev
1 2 3 4 5 6