Hi Everybody,

686-pc-linux-gnu 2.6.20

I've upgraded my original "LFS" software,
glibc-2.3.4/gcc-3.4.3
to "BLFS" glibc-2.5/gcc-4.1.2.

I was curious about how compiled files compare under
the old system and the new (apples to apples) so I ran
a few (unscientific) tests to this effect.
Looks like the new compiler/library increases the size
of the executables quite a bit.  It's possible I'm
missing something although I cannot fathom it. 
Bellow are the results using one simple C and C++ file
and several modules from an e2fsprogs-1.39 build
(sizes in bytes).

              glibc-2.3.4    glibc-2.5
              gcc-3.4.3      gcc-4.1.2    % Larger

HelloWorld    4546           7113         56.46
bjarne          7966           9966         25.10

dumpe2fs     26826          32499         21.15
e2fsck      1354457        2889537       113.34 (?)
fsck           40139          50043         24.67
mke2fs       84258         108100         28.30
tune2fs       52037          60319         15.91

Both glibc and gcc, whether the old versions or the new ones, were
built "by the book" (LFS/BLFS) under the same conditions.

The test programs were compiled/linked the same way:
 gcc -o program program.c
 g++ -o program program.cpp

The e2fsprogs-1.39 modules were built identically as well.

For reference, the test programs:

-- HelloWorld.c
#include <stdio.h>
int main() {
 printf("Hello World!\n");
 return 0;
}

-- bjarne.cpp
// I found this little program on Bjarne Stroustrup's site.
// He recommended it as an "entry-level" Pass/Fail test of
// a new compiler you'd be looking at.
#include<iostream>
#include<string>

using namespace std;

int main() {
  string s;
  cout << "Please enter your first name followed by a newline\n";
  cin >> s;
  cout << "Hello, " << s << '\n';
  return 0;              // this return statement isn't necessary
}

Comments are invited.
Thanks,
-- Alex
-- 
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to