Commit Graph

69 Commits

Author SHA1 Message Date
Brian Gesiak
02fb3ea264 [cmpcodesize] Assert improper use of --list
We can detect improper combinations of --list and
--additional-sections/--category very soon when executing the script.
Assert in those cases. This used to be a warning.
2015-12-16 18:56:16 -05:00
Brian Gesiak
95f22eddcb [cmpcodesize] Use Python indices for separator
Because of the way Python uses references for lists, the logic around
`oldFileArgs`, `newFileArgs`, and `curFiles` is difficult to follow.
Use a less efficient algorithm to find and split the elements based on
the '--' separator.

Although its performance is negligibly worse O(2n) as opposed to O(n), it's
easier to understand and uses one less imperative loop. Also, it's not as if
we'll ever encounter input that makes the performance difference
matter, so :shipit:!
2015-12-16 18:56:16 -05:00
Brian Gesiak
75bf127431 [cmpcodesize] Use argparse
Rather than manually parse the arguments passed to cmpcodesize, use the
Python stdlib. By doing so, we can eliminate a lot of redundant code.

One problem: argparse can't handle positional arguments of the string
'--', since it misinterprets them as optional arguments. We replace
that stirng with a special token.
2015-12-16 18:56:16 -05:00
Brian Gesiak
c7e8eaf7e9 [cmpcodesize] Prevent execution when importing
In order to prevent the Python interpreter from running code that is
meant to be executed directly, the convention is to check the context
in which the code is being interpreted.

Add a check for the context stored in the `__name__` variable, and only
execute the cmpcodesize script if it is being run as a command-line
script (that is, `__main__`).
2015-12-16 18:56:16 -05:00
practicalswift
143134a81e Fix NameError bug: die(…) is Perl, sys.exit(…) is Python :-) 2015-12-14 23:09:56 +01:00
Brian
f04eb91777 Corrected typo: separatly -> separately 2015-12-03 22:29:01 -08:00
Brian
74107034d7 Fixed typos 2015-12-03 21:33:51 -08:00
Roman Levenstein
76fafd94ac Add more detailed statistics to object file comparisons.
Swift SVN r32281
2015-09-28 21:08:18 +00:00
Roman Levenstein
23bb1b8760 Do not count the size of bound generic functions as unbound generic functions.
Swift SVN r32016
2015-09-16 22:36:47 +00:00
Roman Levenstein
9a81de0b44 Compute the code size of Swift generic functions as a separate category.
Swift SVN r32011
2015-09-16 21:23:58 +00:00
Roman Levenstein
ea7678c47e Produce separate code size stats for C++ and ObjC.
Swift SVN r32010
2015-09-16 21:23:57 +00:00
Roman Levenstein
1aa261242b Properly handle cases where an object file contains code for multiple architectures.
Swift SVN r31465
2015-08-26 00:47:21 +00:00
Roman Levenstein
cdc5590efb Distinguish between generic specializations and function signature specializations.
Swift SVN r31461
2015-08-25 23:33:52 +00:00
Roman Levenstein
64b531e27c Allow for upper-case hexadecimals.
Swift SVN r31460
2015-08-25 23:33:52 +00:00
Roman Levenstein
1977b9e957 Better handle object files generated from Objective-C sources.
Swift SVN r31459
2015-08-25 23:33:50 +00:00
Erik Eckstein
af36f6f035 Improvements for the cmpcodesize script.
*) also scan the __textcoal_nt section in addition to the __text section
*) ability so sum the sizes of multiple files



Swift SVN r25781
2015-03-05 13:21:40 +00:00
Erik Eckstein
d99d079905 Fix error message text in cmpcodesize script
Swift SVN r25685
2015-03-02 17:09:14 +00:00
Erik Eckstein
610b2a68e4 Convert cmpcodesize script to python.
Swift SVN r25532
2015-02-25 19:27:58 +00:00
Erik Eckstein
f7a27ae508 Script for comparing code size.
This script can:
*) Compare sizes of text sections (or other sections)
*) Compare sizes of function categories (Swift functions, Protocol Witnesses, Specializations, etc.)
*) Provide a detailed list or comparison of all functions

Use cmpcodesize -h to get info on the usage.

I copied the internals of Nadav's analyzeDylibSize script (Thanks!).
As the function of the analyzeDylibSize is now covered by this new script I deleted the old script.

Sorry that I implemented in ruby and not in python (I know ruby much better than python).



Swift SVN r25501
2015-02-24 15:49:49 +00:00