WebFaction
Community site: login faq

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. echo $CFLAGS returned nothing. Reading make output looks like the default optimization setting for compiling is -O2. There seems to be no architecture-related optimization going on.

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 -march=native to my CFLAGS for the full set of architecture optimizations available.

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 CFLAGS="-Os -march=native" as a global env variable? -march=native has the downside of making a binary that is incompatible with other architectures but I don't think many people are compiling binaries to use on other servers via their Webfaction accounts so I don't see any practical cons.

Thoughts?

asked 30 Jan '14, 23:18

HittingSmoke
4822230
accept rate: 8%

edited 30 Jan '14, 23:49


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.

permanent link

answered 10 Feb '14, 16:57

seanf
12.2k41836
accept rate: 37%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×15
×7
×1

question asked: 30 Jan '14, 23:18

question was seen: 1,883 times

last updated: 10 Feb '14, 16:57

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM