[Toybox] request for comments: pybloat.py

Rob Landley rob at landley.net
Mon Feb 20 17:33:42 PST 2012


On 02/15/2012 04:22 PM, Elie De Brauwer wrote:
> On 02/15/2012 01:54 PM, Rob Landley wrote:
>> On 02/15/2012 06:37 AM, Elie De Brauwer wrote:
>>> Jikes, apparently there is no installation candidate for python2.7, I'll
>>> modify the code to use optarg instead of argparse, python2.7 isn't as
>>> widespread as i thought it was. I'll get a new version for testing out.
>>>
>>> (I considered writing it in sh or C, but the fact that python natively
>>> supports set operations was the reason to keep in in .py).
>>
>> Python is a very nice language. (Although these days with the version
>> skew python is about three very nice languages sharing the same name...)
>>
>> That said, shell is marvelously abuseable:
>>
>> diff<(nm --size-sort toybox_unstripped | sort -k3,3) \
>>       <(nm --size-sort toybox_old | sort -k 3,3) \
>>       | grep "^[<>]" | sort -k4,4
>>
>> (Ok,<(blah) is a bash extension...)
>>
> 
> Well, I promised a version which just uses getopt, and this one I tested
> with python 2.6, so see attach. Next point is whether to send it
> completely to /dev/null, or to modify it if needed to fit our needs (as
> said comments welcome).

Still catching up, I finally got to test this.

I did a "make baseline" on current -tip, and then switched off "swapon"
in menuconfig and did a "make bloatcheck".

With bloat-o-meter, the output was:

function                                             old     new   delta
read_block_header                                   1082    1079      -3
toy_list                                            1824    1792     -32
swapon_main                                           71       -     -71
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/2 up/down: 0/-106)           Total: -106
bytes

With pybloat.py the output was:

--------------------------------------------
|Removals
+--------
                   swapon_main :        -71
                toy_paths.5752 :        -32
                      C.0.5674 :        -32
                      C.0.5670 :        -24
                      C.0.5729 :        -20
--------------------------------------------
|Additions
+---------
                toy_paths.5750 :         32
                      C.0.5672 :         32
                      C.0.5668 :         24
                      C.0.5727 :         20
--------------------------------------------
|Deltas
+------
                      toy_list :        -32
--------------------------------------------
|Summary
+-------
            5 removals gaining :       -179
            4 additions loosing:        108
            1 deltas giving    :        -32
--------------------------------------------
                         Result:       -103
--------------------------------------------

I personally find the first version is a touch easier to read...

Rob

 1329788022.0


More information about the Toybox mailing list