D as a Better C
Parke via Digitalmars-d-announce
digitalmars-d-announce at puremagic.com
Tue Aug 29 17:29:19 PDT 2017
> On Monday, 28 August 2017 at 22:45:01 UTC, Parke wrote:
>> When I write "hello world" in C, the executable is 8,519 bytes.
>> When I write "hello world" in D, the executable is 100 times larger:
>> 865,179 bytes.
On Tue, Aug 29, 2017 at 8:26 AM, Kagamin via Digitalmars-d-announce
<digitalmars-d-announce at puremagic.com> wrote:
> You mean the examples from the blog post
> https://dlang.org/blog/2017/08/23/d-as-a-better-c/ give you 800kb
> executables?
No, I was talking about the below version of "hello world" that I
compiled several weeks prior to reading the blog post.
import std.stdio;
void main() { writeln("Hello, world!"); }
The above D code yields 865,179 bytes.
Below is the version from the blog post:
import core.stdc.stdio;
extern (C) int main( int argc, char** argv ) {
printf ( "hello world\n" );
return 0;
}
The above D code yields 445,244 bytes when compiled with -release.
The above D code yields 445,187 bytes when compiled with -release -betterC.
DMD64 D Compiler 2.075.0-b2 on Linux on x86-64.
Still 50 times larger than C. Perhaps it would be smaller with a
newer version of DMD.
But my original question was about what you (Kagamin) called
"intermediate D". I was trying to understand what "intermediate D"
is, and whether or not I could use "intermediate D" (whatever it is)
to produce small(er) executables.
-Parke
More information about the Digitalmars-d-announce
mailing list