V: Add -flto on production builds

Created on 1 Dec 2019  Â·  3Comments  Â·  Source: vlang/v

$ v -prod -cflags -flto foo.v
$ du -hs foo
 12K    foo
$ v -prod foo.v
$ du -hs foo
 72K    foo
$
Bug Compiler

All 3 comments

As a workaround, you can pass explicitly -cc clang or -cc gcc , in which case -flto will be added with -prod .
The reason is that by default, v uses cc, and v does not know at the moment what exactly cc is on each platform, and if cc supports the -flto flag.

makes sense, but it will be nice if cc default could autodetect the compiler

On 1 Dec 2019, at 20:30, Delyan Angelov notifications@github.com wrote:

As a workaround, you can pass explicitly -cc clang or -cc gcc , in which case -flto will be added with -prod .
The reason is that by default, v uses cc, and v does not know at the moment what exactly cc is on each platform, and if cc supports the -flto flag.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub https://github.com/vlang/v/issues/2948?email_source=notifications&email_token=AAG75FSKMSC5EXIPFLQN7OTQWQGDVA5CNFSM4JTMQHN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFRTD7Y#issuecomment-560148991, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG75FU7BFMD7XJDUZTCUH3QWQGDVANCNFSM4JTMQHNQ.

I agree. When doing -prod, the additional time to autodetect/parse cc --version first will not be a problem.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

radare picture radare  Â·  3Comments

cjmxp picture cjmxp  Â·  3Comments

ArcDrake picture ArcDrake  Â·  3Comments

penguindark picture penguindark  Â·  3Comments

arg2das picture arg2das  Â·  3Comments