digitalmars.D.learn - Large binary size using std.regex
- Bayan Rafeh (10/10) Aug 23 2014 Compiling a simple program using std.regex:
- ketmar via Digitalmars-d-learn (5/6) Aug 23 2014 On Sat, 23 Aug 2014 23:40:12 +0000
- Artem Tarasov (10/13) Aug 23 2014 OTOH, on Linux latest LDC does far better job in eliminating dead
- ketmar via Digitalmars-d-learn (7/9) Aug 23 2014 On Sun, 24 Aug 2014 06:10:20 +0000
- Artem Tarasov (12/13) Aug 23 2014 No, it doesn't:
- ketmar via Digitalmars-d-learn (4/8) Aug 23 2014 On Sun, 24 Aug 2014 06:36:01 +0000
- ketmar via Digitalmars-d-learn (7/7) Aug 23 2014 On Sat, 23 Aug 2014 23:40:12 +0000
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?
Aug 23 2014
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.
Aug 23 2014
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.
Aug 23 2014
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=20 code than DMD:does ldc uses shared runtime here? with dmd -defaultlib=3Dlibphobos2.so test.d i got 657,438 bytes (425,836 stripped). seems that your ldc uses shared runtime.
Aug 23 2014
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)
Aug 23 2014
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=20 Digitalmars-d-learn wrote:hm. ldc rocks. ;-)does ldc uses shared runtime here?No, it doesn't:
Aug 23 2014
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
Aug 23 2014