WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: A Warning to Those who Compile  (Read 1886 times)

Offline andy_jp

  • Newbie
  • *
  • Posts: 8
A Warning to Those who Compile
« on: February 18, 2011, 07:26:26 PM »
As Tiny Core contributors and users, I know that many of you are probably as concerned as I am about the sizes of your executables and libraries, so I thought I'd share some findings from a limited and unscientific experiment I recently carried out.

I recently bought a netbook (with an Intel Atom N270), and was considering moving the maintenance of my extensions from my desktop (with an AMD Athlon XP 2000+) to it. I did, however, have a sneaking suspicion that an in-order processor may produce code which is less optimized than that compiled with an out-of-order processor. I therefore decided to test this by compiling an application (dcraw) on both of my PCs, and found that the Atom consistently produced an executable which was significantly larger (approximately 50%) than that produced by the Athlon. I used the same version of Tiny Core, the same version of GCC, the same dependencies, and the same compiler flags on both machines. I tried a number of combinations of compiler flags (including those suggested on the Tiny Core wiki), and tried to keep them as generic as possible by avoiding those relating to specific architectures, but I always ended up with two executables with very different sizes.

The experiment was very limited in scope, as I only tested one application, and I'm unsure if the results are down to what I originally suspected, or something completely different. If you are concerned, and have more than one processor type at your disposal, I would suggest checking (especially if you're an extension maintainer). One thing I am sure of is that I'm now going to continue using my Athlon to compile.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: A Warning to Those who Compile
« Reply #1 on: February 18, 2011, 09:34:14 PM »
Hi andy_jp
That does not sound right so I tried it myself with a program I'm working on.

gcc-4.2.2 on a Pentium MMX under TC2.10=10908 bytes

gcc-4.4.3 on a Pentium III (Coppermine) under TC3.4=10860 bytes

Close enough.

If you are getting that big a difference then someone/something somewhere is
probably telling GCC to compile for the native CPU.
« Last Edit: February 18, 2011, 10:06:07 PM by Rich »