News for hackers. Stuff that matters.
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by krakensden on Saturday April 12, 2014 @04:18PM (#7579034)
> 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

Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by nly on Saturday April 12, 2014 @05:27PM (#7579276)
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.
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by hf on Saturday April 12, 2014 @05:52PM (#7579338)
For the uninitiated: LTO stands for Link-time optimization and happens when the compiler merges/links all separately-compiled object files into one (executable or library).

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

1) use exorbitant amounts of memory; and

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

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

Thank you!

Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by dietrichepp on Saturday April 12, 2014 @06:06PM (#7579382)
LTO, as the name implies, means that you do another optimization pass at link time. This enables lots of optimizations that don't work when you look at one module at a time.

Functions can be inlined across module boundaries, even when they're not declared inline. You can turn virtual functions into regular functions, if you know that the virtual function is never overridden, or if you can derive the exact type. You can change calling conventions for functions. You can do better escape and aliasing analysis. If a function is only called once, then you can probably optimize it a lot better because you know exactly how it will be called.

As with all optimizations, not all programs will see any significant benefit. Programs with heavy inner loops like physics simulators and graphics processors will not see much benefit, since the local optimizer works well enough. Programs like compilers, interpreters, and web browsers will see larger benefits. However, the benefits can be high—30% improvements in running time are not unheard of.

In short, LTO is a high-cost, high-benefit optimization.

Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by mattgrice on Saturday April 12, 2014 @06:03PM (#7579371)
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.

Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by anaphor on Sunday April 13, 2014 @06:49AM (#7580931)
For an example of a compiler other than GCC that does whole-program optimization see the Stalin Scheme compiler: https://github.com/barak/stalin
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by frozenport on Saturday April 12, 2014 @07:36PM (#7579599)
As a Gentoo user, we always did it on our laptop. Build time was about 30 minutes.
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by bgirard on Sunday April 13, 2014 @01:33AM (#7580351)
Firefox recently (Trunk as of December) started using Unified Sources so builds are now typically 7-9 minutes on laptops now for non Windows platforms.
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by supergauntlet on Saturday April 12, 2014 @04:23PM (#7579049)
well, you could do it on a laptop before, you just needed a much beefier laptop. But that's really impressive, how did they cut the resource usage to a quarter of previous usage?
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by alok-g on Saturday April 12, 2014 @04:34PM (#7579085)
I am very curious too. Such drastic improvements often indicates something wrong before (either in design or implementation) that got fixed.
Re:GCC 4.9 Release Series – Changes, New Features, and Fixes by Denvercoder9 on Saturday April 12, 2014 @06:09PM (#7579389)
I bet it is caused by these two optimizations:

> Early removal of virtual methods reduces the size of object files and improves link-time memory usage and compile time.

> Function bodies are now loaded on-demand and released early improving overall memory usage at link time.