Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
August 23, 2014 Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Compiling a simple program using std.regex: import std.regex; import std.stdio; void main(string[] args) { auto re = regex(args[1], "g"); foreach(line; stdin.byLine) if(line.match(re)) writeln(line); } Renders a 1.6 megabyte binary. Is that normal? |
August 24, 2014 Re: Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bayan Rafeh Attachments: | On Sat, 23 Aug 2014 23:40:12 +0000 Bayan Rafeh via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > Renders a 1.6 megabyte binary. Is that normal? yes. this binary includes statically linked runtime and phobos, plus alot of template expansions. alas, template magic is not free. |
August 24, 2014 Re: Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bayan Rafeh Attachments: | On Sat, 23 Aug 2014 23:40:12 +0000 Bayan Rafeh via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: p.s. strip it. stripping debug info can significantly reduce binary size. for your example: unstripped elf: 1,674,653 bytes stripped elf : 1,074,528 bytes |
August 24, 2014 Re: Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Sunday, 24 August 2014 at 03:14:33 UTC, ketmar via Digitalmars-d-learn wrote:
> yes. this binary includes statically linked runtime and phobos, plus
> alot of template expansions. alas, template magic is not free.
OTOH, on Linux latest LDC does far better job in eliminating dead code than DMD:
$ ldc2 -O -release test.d && ls -l test | cut -f 5- -d ' '
712522 Aug 24 10:07 test
$ dmd -O -release -noboundscheck test.d && ls -l test | cut -f 5- -d ' '
1892622 Aug 24 10:07 test
Which means there's plenty of unfulfilled potential.
|
August 24, 2014 Re: Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Posted in reply to Artem Tarasov Attachments: | On Sun, 24 Aug 2014 06:10:20 +0000 Artem Tarasov via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > OTOH, on Linux latest LDC does far better job in eliminating dead code than DMD: does ldc uses shared runtime here? with dmd -defaultlib=libphobos2.so test.d i got 657,438 bytes (425,836 stripped). seems that your ldc uses shared runtime. |
August 24, 2014 Re: Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Posted in reply to ketmar | On Sunday, 24 August 2014 at 06:20:38 UTC, ketmar via Digitalmars-d-learn wrote:
> does ldc uses shared runtime here?
No, it doesn't:
$ ldd test
linux-vdso.so.1 (0x00007fffce266000)
librt.so.1 => /usr/lib/librt.so.1 (0x00007fc174193000)
libdl.so.2 => /usr/lib/libdl.so.2 (0x00007fc173f8f000)
libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007fc173d71000)
libm.so.6 => /usr/lib/libm.so.6 (0x00007fc173a6d000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fc173857000)
libc.so.6 => /usr/lib/libc.so.6 (0x00007fc1734a9000)
/lib64/ld-linux-x86-64.so.2 (0x00007fc17439b000)
|
August 24, 2014 Re: Large binary size using std.regex | ||||
---|---|---|---|---|
| ||||
Posted in reply to Artem Tarasov Attachments: | On Sun, 24 Aug 2014 06:36:01 +0000 Artem Tarasov via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > On Sunday, 24 August 2014 at 06:20:38 UTC, ketmar via Digitalmars-d-learn wrote: > > does ldc uses shared runtime here? > No, it doesn't: hm. ldc rocks. ;-) |
Copyright © 1999-2021 by the D Language Foundation