> Memory usage building Firefox with debug enabled was reduced from 15GB to 3.5GB; link time from 1700 seconds to 350 seconds.

This is huge- you can now do this on a laptop

15 GB was presumably with LTO enabled, you could always build it on a fairly average laptop with it disabled. This is great news though, as LTO is pretty awesome.

For the uninitiated: LTO stands for \nLink-time optimization and happens when the compiler\nmerges/links all separately-compiled object files\ninto one (executable or library).

Although it seems obvious that this might be a good idea,\nwhy would it

1) use exorbitant amounts of memory; and

2) be "pretty awesome" instead of, say, mildly useful?

edit: And both questions satisfactorily answered\nin the time it took me to peruse the preamble of\nhttps://en.wikipedia.org/wiki/Interprocedural_optimization

Thank you!

Link-time optimization is not a very descriptive term. It's usually called whole-program or interprocedural optimization. Link-time optimization is just how it has been implemented.

It uses a lot of memory because it requires keeping a representation of more or less the entire program in memory at one time, in a format which is amenable to analysis. It is not out of the ordinary for an optimizer's internal representation to be on the order of 1000x the size of the source code.

For an example of a compiler other than GCC that does whole-program optimization see the Stalin Scheme compiler: https://github.com/barak/stalin