Re: Large binary size using std.regex

2014-08-24 Thread Artem Tarasov via Digitalmars-d-learn
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.



Re: Large binary size using std.regex

2014-08-24 Thread ketmar via Digitalmars-d-learn
On Sun, 24 Aug 2014 06:10:20 +
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.


signature.asc
Description: PGP signature


Re: Large binary size using std.regex

2014-08-24 Thread Artem Tarasov via Digitalmars-d-learn
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 (0x7fffce266000)
librt.so.1 = /usr/lib/librt.so.1 (0x7fc174193000)
libdl.so.2 = /usr/lib/libdl.so.2 (0x7fc173f8f000)
libpthread.so.0 = /usr/lib/libpthread.so.0 (0x7fc173d71000)
libm.so.6 = /usr/lib/libm.so.6 (0x7fc173a6d000)
libgcc_s.so.1 = /usr/lib/libgcc_s.so.1 (0x7fc173857000)
libc.so.6 = /usr/lib/libc.so.6 (0x7fc1734a9000)
/lib64/ld-linux-x86-64.so.2 (0x7fc17439b000)




Re: Large binary size using std.regex

2014-08-24 Thread ketmar via Digitalmars-d-learn
On Sun, 24 Aug 2014 06:36:01 +
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. ;-)


signature.asc
Description: PGP signature


Large binary size using std.regex

2014-08-23 Thread Bayan Rafeh via Digitalmars-d-learn

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?


Re: Large binary size using std.regex

2014-08-23 Thread ketmar via Digitalmars-d-learn
On Sat, 23 Aug 2014 23:40:12 +
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.


signature.asc
Description: PGP signature


Re: Large binary size using std.regex

2014-08-23 Thread ketmar via Digitalmars-d-learn
On Sat, 23 Aug 2014 23:40:12 +
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


signature.asc
Description: PGP signature