Webfaction seems to heavily encourage (or at least support) users compiling their own packages. I got curious about the compiler optimizations that are enabled by default. Over the last couple of days I've been playing with a new server stack and I did a side-by-side comparison with different CFLAGS. Compiling PHP with -Os instead of -O2 netted a 60% reduction in the binary size, from 30MB down to about 9.5MB. That was the most drastic change, but Nginx and uWSGI also showed demonstrable improvement in binary size from using -0s. I also added Since WF doesn't seem to set these as defaults, I'm curious if there's any reason I shouldn't do it on WF servers. I can't detect any performance or stability hit from using -Os instead of -O2. It would seem like in an environment where RAM is at a premium on the lowest tier accounts, using the best memory optimization by default would be the most beneficial. If I'm not mistaken, when a package isn't compatible with a certain compiler optimization it will force it to be disabled. However, since -Os is just -O2 with size-increasing optimizations disabled it should have absolutely zero impact on compatibility. Is there any reason I shouldn't be setting my own CFLAGS on Webfaction? If not, might I suggest setting Thoughts? asked 30 Jan '14, 23:18 HittingSmoke |
There's no reason that you shouldn't set your CFLAGS and other environment variables to whatever you need them to be. I'll pass your suggestion along to our sysadmin team for consideration. answered 10 Feb '14, 16:57 seanf |