leonhd / unladen-swallow

Automatically exported from code.google.com/p/unladen-swallow
Other
1 stars 1 forks source link

Massive increase in binary size #118

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
2009Q3 release: $ ls -lh ./python
-rwxr-x--- 1 collinwinter eng 19M Oct  9 15:39 ./python

trunk (r985): $ ls -lh ./python
-rwxr-x--- 1 collinwinter eng 74M Jan 12 16:27 ./python

Oops. We need to find whatever is causing that increase and kill it. 19MB is 
better than 74MB.

Original issue reported on code.google.com by collinw on 14 Jan 2010 at 8:17

GoogleCodeExporter commented 8 years ago
Notes:
- That's 32-bit compilation; same compiler, same machine both times.
- Need to see if this was still a problem before r981, when we started using 
llvm-config 
to get LLVM config params.
- CPython 2.6.4 baseline: 3.8M

Original comment by collinw on 14 Jan 2010 at 8:21

GoogleCodeExporter commented 8 years ago
32-bit Gentoo Linux box with gcc 4.3.4.  I checked out r980 and did a clean 
build. 
Unladen's python is still 72458678 bytes.  So the size problem happened before 
r981.

Original comment by dript...@gmail.com on 19 Jan 2010 at 5:14

GoogleCodeExporter commented 8 years ago
Updating this with my new theory: the massive increase is due to jyasskin's 
work to
get LLVM to build in release mode with debugging symbols.  On my machine, 
stripping
the binary goes from 82 MB to 9.3 MB, so that very little of that blowup is 
code. 
Still, this represents a 5x increase in code size between the stripped python2.6
binary that Ubuntu ships, which is 2.5 MB.

What do we want to do about this?  We're already planning to use the LLVM 2.7 
release
as a shared library, and that library will likely be stripped by any 
distribution, so
I think this problem will go away once we switch to an out of tree LLVM.

Original comment by reid.kle...@gmail.com on 23 Jan 2010 at 8:10

GoogleCodeExporter commented 8 years ago
I hate to be nitpicking, but from my math the size is increased 3.72 times. 
It's still significant, of course, but 
slightly less than 5 times :-) Would it be worthwhile to change the defaults so 
that Python is built as a shared 
library instead? Or perhaps make it so that *both* static and shared libraries 
are built? Then, the Python 
executable itself could be linked against the shared library, which ought to 
mitigate the size increase to some 
extent.

Original comment by danchr on 24 Jan 2010 at 10:56

GoogleCodeExporter commented 8 years ago
Reid is correct:

Unladen Swallow r1041:
--enable-debug-symbols: 77MB
--disable-debug-symbols: 19MB
strip ./python: 12MB

From ``size --format=SysV``, we can see that the debug information in the 
Unladen python binary plummets 
(unstripped):

Unladen + LLVM --enable-debug-symbols:
.debug_aranges         71952           0
.debug_pubnames      1248232           0
.debug_info         42453447           0
.debug_abbrev         822849           0
.debug_line          3210659           0
.debug_frame          561568           0
.debug_str           7358533           0
.debug_loc           8631260           0
.debug_ranges        1437376           0

Unladen + LLVM --disable-debug-symbols:
.debug_aranges          4680           0
.debug_pubnames        52494           0
.debug_info          2358376           0
.debug_abbrev         101275           0
.debug_line           273950           0
.debug_frame           98388           0
.debug_str            504287           0
.debug_loc           1120122           0
.debug_ranges         120000           0

Based on the ``size`` output from the Clang binary in llvm.org's Linux binary 
releases 
(http://llvm.org/releases/2.6/llvm+clang-2.6-i686-linux.tar.gz), llvm.org is 
compiling with --disable-
debug-symbols, and based on the output from the ``python2.5`` and ``python2.6`` 
binaries that Ubuntu 
ships, they're stripping their binaries, too.

Based on that, I think it's only fair that we report the stripped size for 
Unladen Swallow, since that's 
what most people will pick up via their distro's package manager. Updated table 
of on-disk sizes, via ls 
-lh:

32-bit binaries:
Stripped CPython 2.6.4: 1.3MB
Stripped CPython 3.1.1: 1.4MB
Stripped Unladen r1041: 12MB

I'll take a 9x increase over a 20x increase any day.

Original comment by collinw on 26 Jan 2010 at 8:21

GoogleCodeExporter commented 8 years ago
r1044 shaved ~330kb off stripped on-disk binary size. This was easy low-hanging 
fruit, more to come.

Original comment by collinw on 27 Jan 2010 at 1:54