Skip to content

compiling everything for your own cpu (-march=native)

I know the difference will not be noticeable but I'm seriously thinking about this (aka basically turning arch to gentoo).... has anyone actually done it? Is it very annoying to maintain (aka would I be better off just switching to gentoo)?

9 points29 comments
Open on Reddit
About this post
Posted
Archived
Score
9 · 100% up
Kind
Text
ID
4hjack

Author

36
posts
635
comments
1
media
View profile

29 comments

Is it very annoying to maintain (aka would I be better off just switching to gentoo)?

Absolutely.

24 points

I don't know why this was downvoted, it's a fact. If OP wants to compile things with a set of flags/optimizations, of course it's better to switch to a source-based distro. It's possible to do it, but it's really not worth the trouble unless it's just a few packages.

5 points

You're better off just not doing it. Eeking performance out by recompiling everything is not worthwhile.

That said, give it a try. The sooner you learn that micro-managing all the bits of your system is a waste of time the better.

18 points

I used gentoo for years and I know it's more or less a waste of time except for a few specific packages... but I still want to do it, lol.

Not to mention that what's optimal for one package might not be optimal for another (some packages can get a huge boost from stuff like -ffast-math or -Os or -O3 but for most -O3 is pointless, -ffast-math can make the results wrong which may or may not matter, -Os will give a huge boost if it makes things fit in l2 or l1 cache but otherwise is nothing special, the autovectorize stuff could in theory give huge boosts in performance except that compilers suck at it

So thinking about it rationally you are completely right... but that doesn't mean I don't want to do it lol.

1 points

I use march native in my makepkg.conf so AUR packages that are compiled do this.

3 points

It can be overwritten by config file anyway, so not all AUR packages will compile with march native.

1 points

I ran gentoo for years and I know the difference is minimal for most things... I mean if gcc was actually good at converting scalar code to avx2 code there'd be a difference but a compiler automagicaly vectorizing scalar code has been a dream since forever, but such a compiler is still far off (talking about languages most sw is written in not languages (or specific coding styles) that were made with the specific goal of being easy to vectorize (since most software just isn't written like that)) + stuff that benefits the most from such optimizations is hand written in assembly anyway (or in such a style that makes it trivial for the compiler to generate great code)... but most software just isn't like that.... i mean a lot of sw still does everything in a single thread/process instead of at least running the gui and the backend separately.... but I still get the urge to recompile stuff lol

I mean in theory we could have cpu specific packages (which would of course make the devs and the people running the servers hosting the binaries shoot me) and get the benefit of both worlds but nobody would want to maintain that since you would have to target so many architectures that the whole thing would get out of hand fast and the effort to do such a thing would be better spent elsewhere....

2 points

I mean in theory we could have cpu specific packages

If only compilers had an option to specify that code should optionally include optimized code for more advanced CPUs, and enable those features at runtime… We should call it -mtune.

2 points

Gentoo basically lets you do this for the whole system, and is pretty comparable to Arch otherwise.

2 points

I wouldn't recompile EVERYTHING, but I do install ABS and occasionally manually rebuild some of the more performance-critical packages (mostly codecs, ffmpeg, etc for me).

1 points

Did you ever benchmark whether it actually does anything?

3 points

Not recently, but last time I did (years ago) MOST things had very tiny if any (not really worth the trouble) speed up, I seem to recall a reasonable number of things had around 5% performance improvement,and one or two had 25-30% increases (I think LAME was one of them.)

Hmmmm, this would probably be a good topic for a short Hacker Public Radio episode. Maybe I should do some more current tests...

(Especially with GCC 6 reportedly being in [testing] now)

1 points

Media codecs are something that should see benefits from this (unless they are already hand optimized in assembly) + they are a prime candidate for -ffast-math since is's not like the loss of accuracy would do anything bad.

0 points

If you're on Intel, I suggest you take a look at clearlinux.org

1 points

Saw the benchmarks on phoronix.com, pretty impressive :) I hope the other distros are taking notes.

1 points

There is another significant risk here other than time. Security. When you use pacman to install packages, it checks the PGP signature provided by the maintainers. You have no such security check when using the ABS. This normally isn't an issue as building from the ABS is typically a one-off type of thing and checking the PKGBUILD is trivial at that scale.

1 points

I mean I compile my own kernels and the sources do get verified before compiling... only the config files have to be set to skip since you modify them so the checksums obviously change.

1 points

There is no (pgp) verification of the PKGBUILD in ABS. If you do not manually look at the PKGBUILD, then there is no assurance that it isn't malicious. A checksum in the PKGBUILD doesn't change that.

1 points

You could in theory modify the build system to verify the sources before applying your changes.

1 points

(aka would I be better off just switching to gentoo)?

switch to gentoo. Gentoo was purpose built to recompile every package in the system with a consistent flag base. If you need this feature you need gentoo.

you won't really see a massive performance gains. There are only a handful of packages that this would actually benefit.

The kernel would be one of them.

1 points

Even with the kernel the difference is minimal (I know because I did build my own)... I'm sure benchmarks would show some difference but cpus these days are so fast that it doesn't really matter.... you'll just hit a bottleneck somewhere else... I/O most likely.....

1 points

I would say just all in all switching to Gentoo would be easier than going through that. I can suggest funtoo though. I run it on all my secondary systems.

1 points

With ABS you can customize your PKGBUILDs but Arch doesn't have anything like Gentoo's flags, applying your changes to all packages could require some serious shell-fu.

You'd also need scripts to merge your changes into newly downloaded PKGBUILDs, but IIRC there is an application that downloads the PKGBUILDs in git, like Pacaur does. You would still need scripts to handle all this, however.

Annoying to maintain? Once you set it up you wouldn't much maintenance all, just the annoying compilation times and fixing failed merges. I don't see any reason not to do it if you have a powerful machine.

1 points

You can also choose to recompile certain packages instead of the whole system. I usually use yaourt -Sb <package> and cleanup (for mpd most of the time because I don't use all of its functionalities)

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.