Slashdot Mirror


Measuring The Benefits Of The Gentoo Approach

An anonymous reader writes "We're constantly hearing how the source based nature of the Gentoo distro makes better use of your hardware, but no-one seems to have really tested it. What kind of gains are involved over distros which use binary packaging? The article is here."

28 of 467 comments (clear)

  1. Re:Misses the point by Anonymous Coward · · Score: 1, Informative

    ccache and distcc are software, and they can make a huge (as in several orders of magnitude for things like mozilla) difference

  2. Article missed the point by Anonymous Coward · · Score: 1, Informative

    The best way to optimize gentoo is too bootstrap it yourself. This yields impressive performance gains. In my case I settled on these flags:
    -mcpu=pentium4 -march=pentium4 -mmmx -msse2 -Os -fomit-frame-pointer -pi
    pe -fforce-addr -fforce-mem -ffast-math -mpush-args -mfpmath=sse

    The other reason I use gentoo, is that it's easy to stay current. Once a week I do an emerge sync, followed by an emerge -u --deep world. The Gentoo package management system rocks.

  3. Re:Misses the point by countvlad · · Score: 5, Informative

    Portage can be used to install binary (precompiled tbz2 packages of ebuilds).

    From emerge --help:

    --usepkg (-k short option)
    Tell emerge to use binary packages (from $PKGDIR) if they are available, thus possibly avoiding some time-consuming compiles.This option is useful for CD installs; you can export PKGDIR=/mnt/cdrom/packages and then use this option to have emerge "pull" binary packages from the CD in order to satisfy dependencies.

    --usepkgonly (-K short option)
    Like --usepkg above, except this only allows the use of binary packages, and it will abort the emerge if the package is not available at the time of dependency calculation.

    You can also, of course, emerge rpm and install any RPM packages. I'm not sure about debian .deb packages or slackware .tgz packages.

    Gentoo is also accept pre-orders for it's upcoming 1.4 release. Information can be found here, at the Gentoo Store.
    They even have precompiled packages optimizaed for Athlon-XP's - drool!

  4. Happy as a wet turtle Gentoo user by GweeDo · · Score: 3, Informative

    I have been using Gentoo for months now and will never turn back. Little of this has to do with performance and 99.9% of has to do with Portage. Package management, dependency checking and the lot are SO great. Secondly is where performance comes in. Without proper CFLAGS you might as well ignore this. On my Athlon XP 2800 I have this:

    CFLAGS="-march=athlon-xp -O3 -pipe -fomit-frame-pointer -mmmx -msse -m3dnow"

    In some simple tests I have done I have seen this as worth while. I have two pages I have created that might be worth a read:

    CFLAGS Guide
    Is -mmmx and such worth it?

    Hope you enjoy these reads.

    1. Re:Happy as a wet turtle Gentoo user by GweeDo · · Score: 2, Informative

      -mmmx -msse -m3dnow That makes sure they are enabled :) - doesn't = turn off. It is actually a bit redundent since my -march flag turns them on anways :)

    2. Re:Happy as a wet turtle Gentoo user by Fnord · · Score: 4, Informative

      Your "Is -mmmmx and such worth it?" guide is a little unfair. Thing is, you notice that only -O3 really made much of a difference. Well, that's because each of your tests is just one big loop and -O3 does heavy loop unrolling. You basically chose the absolute optimal case for -O3 to win (besides possibly having a small function call inside that loop so that -O3 could inline it). And you didn't do any floating point multiplies or divides which is where -mmmx+sse and -m3dnow would help you.

      If anything you were also using a relatively small dataset. If you get a large enough data set (or code size) -O3 might actually hurt you (loop unrolling and function inlining will bloat both code and data size and make it much more likely to have a cache miss).

      Anyways, synthetic benchmarks are one thing but your is so synthetic as to be rediculous.

    3. Re:Happy as a wet turtle Gentoo user by Anonymous Coward · · Score: 1, Informative

      Actually -mmmx, -msse, and -m3dnow simply turn on the __builtin_ functions that interface the relevant instructions. This is for developers, and if they do not use them, they will not do anything. Now -fpmath=sse will change the code generated by GCC, but -msse will not. In Gentoo those flags will be used by packages that actually would make use of them, presuming of course that you have the relevant USE parameters. Putting them in your CFLAGS is simply stupid.

  5. Re:You still have dependency hell by GweeDo · · Score: 4, Informative

    Looks like someone failed to set their USE flag properly. If you have it set right you will get support for all you want. Or if you do "emerge -vp packagname" before doing an actual emerge you can see what optional flags aren't getting used. People that use Gentoo but don't read the portage/emerge/use documents are asking for this. Gentoo isn't for all, it is only for the willing.

    Please go here and reas as much as possible for installing Gentoo so you don't do something stupid.

  6. Re:Remember the KDE mandrake/gentoo fiasco? by mickwd · · Score: 2, Informative

    It's not part of the main distro, but there is a kernel-multimedia-2.4.21.0.16mdk-1-1mdk.i586.rpm in Mandrake contribs. Check it out if you want a more responsive kernel.

  7. Re:Misses the point by Sancho · · Score: 4, Informative

    One of my favorite uses for Gentoo is optimizing for size rather than execution speed. As you say, the CPU is rarely the bottleneck these days, but loading files from the disk can be a factor in a program starting up. I've done the benchmarks, and some rather large programs see significantly reduced load times when optimized with -Os.

  8. Re:You still have dependency hell by Anonymous Coward · · Score: 1, Informative

    Watch this space for an excellent Gentoo installation tool. This guy is doing some pretty great work (pretty much by himself) making the gentoo installation quite literally a five step process. He plans on adding GUI support soon and gentoo has a hardware autodetection kernel used by glis, so you're set.

  9. Re:Why use it? by Anonymous Coward · · Score: 1, Informative

    The biggest problem with APT-rpm that I have is that APT isn't very "apt" when it comes to installing the new redhat kernels. I prefer yum (http://linux.duke.edu/projects/yum/). I haven't used apt in a while, but I got tired of typing rpm --rebuilddb after 75 updates I installed on my system. I don't know if they ever fixed that bug.
    After running yum for most of a year, I definitely prefer yum to apt-rpm.

    That said, I find it interesting that there's really no reason an APT-rpm or Yum can't be modified to do essentially the same thing that emerge does with Gentoo.

    I've had my share of source RPM's that wouldn't compile correctly without some modification to the spec file. But I would like to see someone modify yum to use the source rpms, install all the devel packages and then install it. As an added benefit red hat, mandrake would make better source rpms explicitly for that purpose.

  10. Re:Misses the point by nagora · · Score: 4, Informative
    but, realistically, how often do you do those things in the normal case?

    You obviously don't use GIMP or analyse OS mapping data much. I have the RAM to get the info into memory, IO is not an issue for much of my work.

    Having said that, portage is the main reason I've converted all my machines to Gentoo; it's just not a serious option to go back to RPM based systems after using it for a week or so.

    TWW

    --
    "Encyclopedia" is to "Wikipedia" what "Library" is to "Some people at a bus stop"
  11. Re:Remember the KDE mandrake/gentoo fiasco? by buchanmilne · · Score: 2, Informative

    Mandrake while my favorite choice, doesnt include the best pre-emptive kernels.

    You mean like this one (from contrib for 9.1)?


    Name : kernel-multimedia-2.4.21.0.16mdk
    Group : System/Kernel and hardware Source RPM: kernel-multimedia-2.4.21.0.16mdk-1-1mdk.src.rpm
    L icense: GPL
    Packager : Danny Tholen
    URL : http://www.kernel.org/
    Summary : A preemptible Linux kernel, which reduces the latency of the kernel.
    Description :
    This kernel includes patches useful for multmedia purposes like:
    preemption, low-latency and the ability for processes to transfer their
    capabilities.
    The preemtion patches allow a task to be preempted anywhere within the kernel,
    using spinlocks as markers for non-preemptibility regions. The resulting
    system response is greatly increased, with measured average latencies under
    1ms. Andrew Morton's low-latency patches fix the remaining points in the kernel
    that cause latency. The setpcap patch allows suid root processess to transfer
    capabilities to non-root processess, and so making it possible for user
    processes to run with realtime priority.


    [some uninteresting fields removed in aid of the lameness filter]

    The next one for 9.2 contrib will most likely have the O(1) scheduler also.

  12. Re:Remember the KDE mandrake/gentoo fiasco? by trashme · · Score: 2, Informative
    Myself, Gentoo's biggest feature was the kernal compile options, adding patches for pre-emptive mulitasking, and improved responsiveness.
    Ahem. I'm guessing you are talking about the preemptive kernel patch. Linux, and every other modern OS, already have preemptive multi-tasking. Preempting the kernel is different from preemptive multi-tasking.

    Preemptive multi-tasking just means that a process can be interrupted at any point and another process, or the OS, can make use of the CPU. Preempting the kernel means that actual kernel code can be interrupted.

    There are other distributions that include kernel patches as packages. Debian, for example, let's you patch your kernel with a compile option passed to make-kpkg.
  13. Re:Misses the point by gibber · · Score: 4, Informative

    Changing the CPU multiplier will not give you what you are looking for as it will likely change your FSB speed and L1/L2 cache access rates. The most common bottlenecks on systems are heirarchical IO bandwidth related. For example, having scads of RAM for buffer/cache will help you with disk IO woes.

    Compiling binaries with optimization for a particular processor help with i-cache and d-cache utilization. The fewer instructions fetched (or the order in which they are fetched) makes a big difference in performance.

    Boosting CPU cache size (up to practical cache limits), increasing FSB speed and avoiding disk IO are much more significant than CPU M/GHz.

    Compilation, especially optimized (-0X) compilation is _VERY_ CPU intense. If you have enough RAM to avoid the disk thrashing caused by writing numerous intermediate files you will peg your CPU.

    Most user activities (aside from games) on computers are not bottlenecked by CPU but by various heirarchical IO constraints and hence the previous poster was correct that the CPU is not a significant bottleneck on modern systems.

  14. CFLAGS detection script by cosjef · · Score: 2, Informative

    Here's a script that helps you determines which CFLAGS are compatible with your CPU:

  15. Re:Slow? by Rhone · · Score: 2, Informative

    Speaking as someone who used Debian ("unstable") for years and switched to Gentoo a few months ago....

    First of all, Gentoo has definitely improved since you tried it. It has worked quite well for me, and I can't recall anything failing to compile. I imagine that if something as significant as gcc were broken, the problem would probably be rectified rather quickly. I worry more about fringe programs that few people are using.

    Anyway, my answer to your question of whether Gentoo is like the "unstable" branch of Debian would have to be "yes and no".

    It's like the unstable branch in the sense that the newest versions of software are easily available to you soon after they are released. It's also like the unstable branch in the sense that you can try out that new software before it has undergone weeks or months of testing with the rest of the system, and like Debian unstable it is best for the geekier crowd who can deal with unexpected problems here and there (I'm being somewhat hypothetical here, because I haven't really had any such problems in Gentoo).

    It's also like Debian unstable in the sense that it's actually usually more stable than the released versions of many of the rpm-based distros. (Though it's been a while since I last used Mandrake or RedHat, so perhaps they have improved their stability as well?)

    It's unlike Debian unstable in the sense that you have more power to fix the problems that may come up (at least problems that can be blamed on the distro and not on the software itself). I felt kind of helpless with Debian unstable when dpkg would choke on a deb. You can't do much (that I know of) to edit an already packaged deb, and getting the src deb to try to find the problem seems like kind of a daunting task for a non-Debian-developer.

    In Gentoo, if there's a problem in an ebuild and you don't want to wait for it to get fixed... well, you have all of the ebuilds right there on your hard drive under /usr/portage. Ebuilds are fairly straight-forward; it doesn't take too long to learn how they work so that you can make simple edits, or even create your own. Also, ebuilds for old versions usually hang around for a while, so if a program is working fine for you and then there's a bug in a new version, you can downgrade easily.

    One of the features I like is that you can put your own ebuilds in /usr/local/portage, and they will be handled gracefully by emerge. And /usr/local/portage takes precedence over the stuff in /usr/portage, so you can use it to replace existing ebuilds in a way that won't be overwritten next time you "emerge sync".

    In Gentoo you are really never helpless.

  16. Re:Slow? by lewp · · Score: 2, Informative

    You very well may know this already, but Daniel Stone has an unofficial apt repository with XFree86 4.3.0 packages. I've been using them for months with great success.

    http://penguinppc.org/~daniels/xfree86/README

    If you just like compiling X, or have some other reason to, forget I said anything :).

    --
    Game... blouses.
  17. Re:Slow? by mcp33p4n75 · · Score: 2, Informative
    Yes. Whether or not you have stable packages depends on your ACCEPT_KEYWORDS setting in /etc/make.conf. Say, you want stable on x86, you do:
    ACCEPT_KEYWORDS="x86"
    Or, you want unstable packages (like me :):
    ACCEPT_KEYWORDS="~x86"
    It's pretty simple, really.
    As some worthless anecdotal evidence, I have never had a problem with the stable packages, and i've been using Gentoo for nearly a year. As for the unstable, most of the problems I have had are build/configuration errors.
  18. Working with debs. by dmaxwell · · Score: 2, Informative

    debs are actually renamed ar archives that conform to a specification and have been renamed. I have come across guides on unaring a deb,altering it and then packing it back up. I've never had to do it but the guides on how to do it didn't seem too bad.

    I've never had a dependency problem I couldn't fix in Debian with a little noodling around with the system. On the other hand, I do sometimes recompile source debs to get options that I need. For instance, I deploy Netatalk with dhx authentication. I have to install the crypto devel libs and tweak the rules file to get it. Thankfully, I can build on one box and deploy the custom deb whereever needed.

    I suspect that I could get most of the benefit of Gentoo by rebuilding the kernel, glibc, and maybe the xlib source debs with i686 options. At some point, I would like to see where the most benefit is reaped from custom compilation.

  19. Re:Misses the point by Arker · · Score: 2, Informative

    Actually I think the key sentence of the article was this:

    The Gentoo setup by Bill Kenworthy was compiled using the "stock" kernel source and the "-march=pentium3 -pipe -O3" compile flags.

    Doh! No wonder it sucked.

    O3 turns on things like inlining that are only worthwhile in certain circumstances, but are often counterproductive. So the results aren't surprising in the least.

    --
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Friends don't let friends enable ecmascript.
  20. Re:Misses the point by Arker · · Score: 2, Informative

    Seriously though, doubling the access speed of your RAM is likely to do more good on that sort of task than doubling the CPU speed.

    --
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Friends don't let friends enable ecmascript.
  21. Re:The Mindcraft method, against itself by Arker · · Score: 2, Informative

    -Os is stupid...
    Just try that on a P4.

    What exactly are you trying to say?

    -Os decreases cache misses, and that's just as important on a P4 as on any other CPU.

    If they really wanted to test performance, they would have used bzip2 -9. I don't even understand what they are testing. Are they testing how long it takes to start an app??? That can depend on where on the disk the files are stored. What a silly test.

    Opening applications is something most users probably do a lot more often than running bzip.

    --
    =-=-=-=-=-=-=-=-=-=-=-=-=-=-
    Friends don't let friends enable ecmascript.
  22. Re:So is linux by pantherace · · Score: 2, Informative

    prelink can help with this. google for it and you should find out about it or look on gentoo.org under the docs section. Prelink support is built into portage :)

  23. Re:You still have dependency hell by axxackall · · Score: 2, Informative
    People that use Gentoo but don't read the portage/emerge/use documents are asking for this. Gentoo isn't for all, it is only for the willing.

    I usually say: Gentoo is for users who can read.

    --

    Less is more !
  24. Re:Define 'same' by VPN3000 · · Score: 4, Informative

    Agreed. Back when I was a hardware tech in the early 90's, I recall building pools of identical machines for customer orders. For burn-in, I would loop benchmarks for 24 hours before shipping them out. There was typically 1-2% difference in identical systems.

    People tend to forget the complexity of a PC and the inevitable, microscopic differences each part made. Thus differences in resistance, heat generated, and performance.

  25. Re:No. Gentoo is not a performance leader. by 0x0d0a · · Score: 2, Informative

    Also, I don't recomend Gentoo for most users- I am not a fanatic, I just like configuring things myself so when something messes up, there's only one person to blame (go slackware!).

    I'm all for folks recommending things they enjoy. The only thing that upsets me is the repeated number of Gentoo users that come on Slashdot or Usenet and make claims that simply are not true about the benefits distro. I see a *ton* of Debian fans pushing their own distro, but usually it comes down to someone claiming an ideological difference or liking the distro's packaging policy -- you don't see a bunch of claims that Debian is much faster or more stable than other distros. It hurts all Linux folks to have a lot of false information floating around, and it really doesn't do Gentoo any more good than it does to have Linux folks making outrageous claims about Linux's capabilities.

    What you should note is that there ARE performance gains, though slight.

    [shrug] That's probably true. -fomit-frame-pointer, at the least is pretty sure not to hurt you aside from the inability to debug.

    I didn't know there were this many gentoo-haters out there, but I definitely see only good things from this distribution. No need to bash it nor me. That's getting a little childish.

    I don't think I was bashing Gentoo -- I specifically said that it was a "worthy distro". I may have been slightly harsh towards you, simply because of my frusteration with the behavior of a large number of Gentoo users on various forums, but I don't think it was particularly out of line, and I pointed out that I've been in the same boat WRT compile flags.

    What I was saying was Gentoo is definitely a distribution to try for new and intermediate users to get to know how their system works and what can be done (e.x.- what services are unneeded) to speed it up.

    [shrug] I'm not saying it's *bad* for them, though every distribution I know of (well, I don't know precisely how Debian deals with source, so perhaps not Debian) provides a pretty good learning system. On rpm based systems, you can just create ~/.rpmrc, modify buildarchtranslate, fill in an OPTFLAGS field, and then use rpm --rebuild on a SRPM to do the same rebuilds that you'd do on Gentoo.

    My other real irritation is the number of (a long time ago, mostly Slackware, now mostly Gentoo) users that run around telling would-be Linux gurus that any advanced users *clearly* use a system in which they build their own packages. This tends to put these people in a position of feeling that they need to use a particular distro to prove their tech balls. It's not a particularly friendly environment for any new users. (They ignore, of course, the fact that Linus uses KDE on SuSE, and Alan Cox GNOME on Red Hat -- and both of them seem comfortable).

    Does that make Gentoo bad at all? No. Of course not. I'd just like to keep the twin nastinesses of "Bob sucks, because he only uses distro X" and "Distro Y beats the shit out of other distros when it comes to performance/stability/other inflated claim" to a minimum.