The chrome team does exactly what you describe. They both compile for size on some platforms (because in practice it's faster for several reasons) as well as spend a lot of time researching speed vs memory trade offs and making those deliberately. In recent times the memory trade offs were also sometimes related to reducing power consumption.
There was a lot of debate back in the Gentoo days about whether to compile with -O3, -O2, or -Os
-Os meant faster launch times, which for desktop Linux made sense, but in classic Gentoo fashion a big group used -O3 and then did a bunch of hacks to make sure binaries would be loaded at startup and never be evicted from memory (even if the application itself wasn't running).
Gentoo was delightfully silly about this stuff, and mostly self aware that it was excessive.
Re:Flow browser passes the Acid tests
by IgorPartola on Sunday June 14, 2020 @09:17AM
(#23517445)
Oh god I remember this. Compiling the compiler to compile it again to compile the kernel to install everything. Every few weeks. While trying to find something that used less memory than openbox.
Re:Flow browser passes the Acid tests
by MereInterest on Saturday June 13, 2020 @10:55PM
(#23514725)
Depending on the conditions, you can get faster speed with -Os even if the binary is never evicted from memory. If you are optimizing for size, then you may be able to fit more of the program into the CPU cache, which can be accessed much faster than the main memory.
Weren't there tests back then that showed -Os was actually faster on a lot of modern CPUs? Something like more of the binary staying in CPU cache?
> Do they actually test both approaches, or is it more a matter of "we can code it way A or way B, and way A uses more memory, but we think it'll be faster"?
A lot of memory consumption is various caches (at various layers); those caches weren't added for no reason, they were added because they provided a demonstrable a perf gain.
Do they actually test both approaches, or is it more a matter of "we can code it way A or way B, and way A uses more memory, but we think it'll be faster"?
Many years ago I worked at Watcom, back when they made "the" C++ compiler for DOS games. (Doom, Descent, Duke Nukem 3D, and Tomb Raider all used it.)
The compiler had various optimization settings, and some optimized for size, while other optimized for speed. The compiler was used to compile itself. They normally compiled with the "optimize for size" settings enabled, but one time they decided to try optimizing it for speed to see how fast it could be.
It turned out that optimizing it "for speed" made it considerably slower because of the cache.