views:

805

answers:

2

What is there to gain from the use of this switch in a large VS solution (200 VC projects)?

From what I understand this mainly effects the size of the resulting binaries; but aside from smaller binaries, could FLL also help in reducing dependencies between projects?

How does FLL usually effect build times?

I'd also appreciate an educated explanation on FLL in VC. MSDN's explanation is pretty succinct.

+8  A: 

Since you linked MSDN's explanation, you know that /Gy ensures that all functions are packaged in their own COMDAT. The main advantage of this is that if you have identical functions the linker can collapse them all down into one actual piece of code ("COMDAT folding"). This can have very large impacts when you have many identical functions, which is often the case when you write modern C++ that is heavy on templates.

Aside from the smaller size of the resulting executable due to COMDAT folding and elimination of unreferenced COMDATs, there's no other effect of /Gy. To be specific, it doesn't help in reducing interproject dependencies.

The cost is a slight increase in compilation time (similar to other optimizer flags). Usually not something you'll notice.

mwigdahl
@mwigdahl: if application A references a function F1 in static library B, which resides (without /Gy) in the same COMDAT section with a function F2 in B that references symbol F3 in C, this creates a dependency between A and C which would otherwise not be needed. If A and B do not have a project dependency on C defined, A would not compile even though no code path from A references F3, and this would be prevented by /Gy. Is this wrong?
Pavel Radzivilovsky
+1  A: 

To add on to mwigdahl's excellent post: here's a link that explains how to achieve FLL for g++ -- this may give you some additional insights.

dirkgently